FIX: Ensure category-tag filter routes are functioning (#17420)

This regressed as part of the changes in fc36ac6c.

This commit also introduces a test which would have caught the issue.
This commit is contained in:
David Taylor 2022-07-11 10:54:51 +01:00 committed by GitHub
parent 5a4c35f627
commit 0ffa93ccaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -107,15 +107,15 @@ export default {
})
);
app.register(
`route:tag.show-${filterDasherized}-category`,
`route:tags.show-category-${filterDasherized}`,
TagShowRoute.extend({ navMode: filter })
);
app.register(
`route:tag.show-${filterDasherized}-category-none`,
`route:tags.show-category-none-${filterDasherized}`,
TagShowRoute.extend({ navMode: filter, noSubcategories: true })
);
app.register(
`route:tag.show-${filterDasherized}-category-all`,
`route:tags.show-category-all-${filterDasherized}`,
TagShowRoute.extend({ navMode: filter, noSubcategories: false })
);
});

View File

@ -284,6 +284,7 @@ acceptance("Tag info", function (needs) {
[
"/tags/c/faq/4/planters/l/latest.json",
"/tags/c/feature/2/planters/l/latest.json",
"/tags/c/feature/2/planters/l/top.json",
"/tags/c/feature/2/none/planters/l/latest.json",
].forEach((url) => {
server.get(url, () => {
@ -497,6 +498,17 @@ acceptance("Tag info", function (needs) {
assert.strictEqual(currentURL(), "/tags/c/feature/2/none/planters");
});
test("can visit show-category-latest routes", async function (assert) {
await visit("/tags/c/feature/2/planters");
await click(".nav-item_latest a[href]");
// await pauseTest();
assert.strictEqual(currentURL(), "/tags/c/feature/2/planters/l/latest");
await click(".nav-item_top a[href]");
assert.strictEqual(currentURL(), "/tags/c/feature/2/planters/l/top");
});
test("admin can manage tags", async function (assert) {
updateCurrentUser({ moderator: false, admin: true });