Skip to content

Commit

Permalink
DEV: fix specs with new mobile footer UI (#619)
Browse files Browse the repository at this point in the history
Dependent on discourse/discourse#30132 getting
merged.

The UI for the "hidden" topic footer buttons on mobile changes from
SelectKit to DMenu, so the specs needed to be updated as such.
  • Loading branch information
ZogStriP authored Dec 11, 2024
1 parent d2454e9 commit 215e1e3
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 37 deletions.
11 changes: 0 additions & 11 deletions assets/stylesheets/assigns.scss
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,6 @@
}
}

#topic-footer-button-assign {
padding-top: 0.35em;
padding-bottom: 0.35em;
.d-button-label {
.avatar {
margin-right: 0.25em;
}
}
}

#topic-footer-dropdown-reassign {
.name {
font-weight: normal;
Expand Down Expand Up @@ -196,7 +186,6 @@
}

// Group assigns sidebar nav

.group-assignments {
// a little extra space for long names
min-width: 250px;
Expand Down
10 changes: 3 additions & 7 deletions test/javascripts/acceptance/assign-disabled-test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { visit } from "@ember/test-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";

acceptance("Discourse Assign | Assign disabled mobile", function (needs) {
needs.user({ can_assign: true });
Expand All @@ -10,10 +9,7 @@ acceptance("Discourse Assign | Assign disabled mobile", function (needs) {

test("Footer dropdown does not contain button", async function (assert) {
await visit("/t/internationalization-localization/280");

const menu = selectKit(".topic-footer-mobile-dropdown");
await menu.expand();

assert.false(menu.rowByValue("assign").exists());
await click(".topic-footer-mobile-dropdown-trigger");
assert.dom(".assign").doesNotExist();
});
});
11 changes: 3 additions & 8 deletions test/javascripts/acceptance/assign-enabled-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,14 @@ acceptance("Discourse Assign | Assign mobile", function (needs) {
test("Footer dropdown contains button", async function (assert) {
updateCurrentUser({ can_assign: true });
await visit("/t/internationalization-localization/280");
const menu = selectKit(".topic-footer-mobile-dropdown");
await menu.expand();

assert.true(menu.rowByValue("assign").exists());
await menu.selectRowByValue("assign");
await click(".topic-footer-mobile-dropdown-trigger");
await click(".assign");
assert.dom(".assign.d-modal").exists("assign modal opens");
});
});

acceptance("Discourse Assign | Assign desktop", function (needs) {
needs.user({
can_assign: true,
});
needs.user({ can_assign: true });
needs.settings({ glimmer_post_menu_mode: "enabled", assign_enabled: true });

needs.pretender((server, helper) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@ acceptance(
test("Footer dropdown contains button", async function (assert) {
updateCurrentUser({ can_assign: true });
await visit("/t/internationalization-localization/280");
const menu = selectKit(".topic-footer-mobile-dropdown");
await menu.expand();

assert.true(menu.rowByValue("assign").exists());
await menu.selectRowByValue("assign");
await click(".topic-footer-mobile-dropdown-trigger");
await click(".assign");
assert.dom(".assign.d-modal").exists("assign modal opens");
});
}
Expand Down
11 changes: 5 additions & 6 deletions test/javascripts/acceptance/assigned-topic-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { visit } from "@ember/test-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import topicFixtures from "discourse/tests/fixtures/topic";
import {
Expand Down Expand Up @@ -220,14 +220,13 @@ acceptance("Discourse Assign | Reassign topic | mobile", function (needs) {

test("Mobile Footer dropdown contains reassign buttons", async function (assert) {
updateCurrentUser({ can_assign: true });
const menu = selectKit(".topic-footer-mobile-dropdown");

await visit("/t/assignment-topic/44");
await menu.expand();
await click(".topic-footer-mobile-dropdown-trigger");

assert.true(menu.rowByValue("unassign-mobile").exists());
assert.true(menu.rowByValue("reassign-mobile").exists());
assert.true(menu.rowByValue("reassign-self-mobile").exists());
assert.dom("#topic-footer-button-unassign-mobile").exists();
assert.dom("#topic-footer-button-reassign-self-mobile").exists();
assert.dom("#topic-footer-button-reassign-mobile").exists();
});
});

Expand Down

0 comments on commit 215e1e3

Please sign in to comment.