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 {
|
import {
|
||||||
acceptance,
|
acceptance,
|
||||||
exists,
|
exists,
|
||||||
|
loggedInUser,
|
||||||
|
publishToMessageBus,
|
||||||
query,
|
query,
|
||||||
queryAll,
|
queryAll,
|
||||||
} from "discourse/tests/helpers/qunit-helpers";
|
} 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 visit("/");
|
||||||
await click(".d-header-icons .current-user");
|
await click(".d-header-icons .current-user");
|
||||||
|
|
||||||
const customTab1 = query("#user-menu-button-custom-tab-1");
|
assert.ok(
|
||||||
const customTab2 = query("#user-menu-button-custom-tab-2");
|
exists("#user-menu-button-custom-tab-1"),
|
||||||
|
"first custom tab is rendered"
|
||||||
assert.ok(customTab1, "first custom tab is rendered");
|
);
|
||||||
assert.ok(customTab2, "second custom tab is rendered");
|
assert.ok(
|
||||||
|
exists("#user-menu-button-custom-tab-2"),
|
||||||
assert.strictEqual(
|
"second custom tab is rendered"
|
||||||
customTab1.dataset.tabNumber,
|
|
||||||
"5",
|
|
||||||
"custom tab has the right tab number"
|
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.strictEqual(
|
const tabs = [...queryAll(".tabs-list.top-tabs .btn")];
|
||||||
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
|
|
||||||
|
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
tabs.map((t) => t.dataset.tabNumber),
|
tabs.reduce((acc, tab) => {
|
||||||
["0", "1", "2", "3", "4", "5", "6", "7", "8"],
|
acc[tab.id] = tab.dataset.tabNumber;
|
||||||
"data-tab-number of the tabs has no gaps when custom tabs are added"
|
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(
|
let customTab1Bubble = query(
|
||||||
|
|
Loading…
Reference in New Issue