mirror of
https://github.com/discourse/discourse.git
synced 2025-03-04 06:49:39 +08:00
FIX: Category sidebar link not active when filtered by none and all (#18578)
This commit is contained in:
parent
940eb0ce4d
commit
7e94fa86d7
@ -37,7 +37,7 @@ export default class CategorySectionLink {
|
||||
}
|
||||
|
||||
get currentWhen() {
|
||||
return "discovery.unreadCategory discovery.topCategory discovery.newCategory discovery.latestCategory discovery.category";
|
||||
return "discovery.unreadCategory discovery.topCategory discovery.newCategory discovery.latestCategory discovery.category discovery.categoryNone discovery.categoryAll";
|
||||
}
|
||||
|
||||
get title() {
|
||||
|
@ -78,6 +78,12 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
||||
});
|
||||
});
|
||||
|
||||
server.get(`/c/:categorySlug/:categoryId/none/l/latest.json`, () => {
|
||||
return helper.response(
|
||||
cloneJSON(discoveryFixture["/c/bug/1/l/latest.json"])
|
||||
);
|
||||
});
|
||||
|
||||
server.get("/c/:categorySlug/:categoryId/find_by_slug.json", () => {
|
||||
return helper.response(cloneJSON(categoryFixture["/c/1/show.json"]));
|
||||
});
|
||||
@ -355,6 +361,40 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
||||
);
|
||||
});
|
||||
|
||||
test("visiting category discovery no subcategoriees route", async function (assert) {
|
||||
const { category1 } = setupUserSidebarCategories();
|
||||
|
||||
await visit(`/c/${category1.slug}/${category1.id}/none`);
|
||||
|
||||
assert.strictEqual(
|
||||
count(".sidebar-section-categories .sidebar-section-link.active"),
|
||||
1,
|
||||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-${category1.slug}.active`),
|
||||
"the category1 section link is marked as active for the none route"
|
||||
);
|
||||
});
|
||||
|
||||
test("visiting category discovery includes all subcategories route", async function (assert) {
|
||||
const { category1 } = setupUserSidebarCategories();
|
||||
|
||||
await visit(`/c/${category1.slug}/${category1.id}/all`);
|
||||
|
||||
assert.strictEqual(
|
||||
count(".sidebar-section-categories .sidebar-section-link.active"),
|
||||
1,
|
||||
"only one link is marked as active"
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
exists(`.sidebar-section-link-${category1.slug}.active`),
|
||||
"the category1 section link is marked as active for the all route"
|
||||
);
|
||||
});
|
||||
|
||||
test("new and unread count for categories link", async function (assert) {
|
||||
const { category1, category2 } = setupUserSidebarCategories();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user