DEV: Fix the build (#17853)
473695ee4d
and23520b88c2
were merged very close to each other, but they had some subtle conflicting changes that broke some tests.
This commit is contained in:
parent
473695ee4d
commit
590a13377b
|
@ -2,6 +2,8 @@ import { click, visit } from "@ember/test-helpers";
|
|||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
loggedInUser,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -90,42 +92,44 @@ acceptance("User menu", function (needs) {
|
|||
};
|
||||
});
|
||||
});
|
||||
const expectedTabOrder = {
|
||||
"user-menu-button-all-notifications": "0",
|
||||
"user-menu-button-replies": "1",
|
||||
"user-menu-button-mentions": "2",
|
||||
"user-menu-button-likes": "3",
|
||||
"user-menu-button-messages": "4",
|
||||
"user-menu-button-bookmarks": "5",
|
||||
"user-menu-button-custom-tab-1": "6",
|
||||
"user-menu-button-custom-tab-2": "7",
|
||||
"user-menu-button-review-queue": "8",
|
||||
};
|
||||
|
||||
await visit("/");
|
||||
await click(".d-header-icons .current-user");
|
||||
|
||||
const customTab1 = query("#user-menu-button-custom-tab-1");
|
||||
const customTab2 = query("#user-menu-button-custom-tab-2");
|
||||
|
||||
assert.ok(customTab1, "first custom tab is rendered");
|
||||
assert.ok(customTab2, "second custom tab is rendered");
|
||||
|
||||
assert.strictEqual(
|
||||
customTab1.dataset.tabNumber,
|
||||
"5",
|
||||
"custom tab has the right tab number"
|
||||
assert.ok(
|
||||
exists("#user-menu-button-custom-tab-1"),
|
||||
"first custom tab is rendered"
|
||||
);
|
||||
assert.ok(
|
||||
exists("#user-menu-button-custom-tab-2"),
|
||||
"second custom tab is rendered"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
customTab2.dataset.tabNumber,
|
||||
"6",
|
||||
"custom tab has the right tab number"
|
||||
);
|
||||
|
||||
const reviewQueueTab = query("#user-menu-button-review-queue");
|
||||
|
||||
assert.strictEqual(
|
||||
reviewQueueTab.dataset.tabNumber,
|
||||
"7",
|
||||
"review queue tab comes after the custom tabs"
|
||||
);
|
||||
|
||||
const tabs = [...queryAll(".tabs-list .btn")]; // top and bottom tabs
|
||||
const tabs = [...queryAll(".tabs-list.top-tabs .btn")];
|
||||
|
||||
assert.deepEqual(
|
||||
tabs.map((t) => t.dataset.tabNumber),
|
||||
["0", "1", "2", "3", "4", "5", "6", "7", "8"],
|
||||
"data-tab-number of the tabs has no gaps when custom tabs are added"
|
||||
tabs.reduce((acc, tab) => {
|
||||
acc[tab.id] = tab.dataset.tabNumber;
|
||||
return acc;
|
||||
}, {}),
|
||||
expectedTabOrder,
|
||||
"data-tab-number of the tabs has no gaps when custom tabs are added and the tabs are in the right order"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query(".tabs-list.bottom-tabs .btn").dataset.tabNumber,
|
||||
"9",
|
||||
"bottom tab has the correct data-tab-number"
|
||||
);
|
||||
|
||||
let customTab1Bubble = query(
|
||||
|
|
Loading…
Reference in New Issue