FIX: Correct urls to account for subfolder setup (#24941)

This commit is contained in:
Natalie Tay 2023-12-18 16:49:06 +08:00 committed by GitHub
parent ecdad60e47
commit e24c015b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 11 deletions

View File

@ -1,4 +1,4 @@
<a href="/tags">
<a class="tag-groups--back" href={{get-url "/tags"}}>
{{d-icon "chevron-left"}}
<span>{{i18n "tagging.groups.back_btn"}}</span>
</a>

View File

@ -6,22 +6,27 @@ import {
query,
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { setPrefix } from "discourse-common/lib/get-url";
acceptance("Tag Groups", function (needs) {
needs.user();
needs.settings({ tagging_enabled: true });
needs.pretender((server, helper) => {
const tagGroups = {
tag_group: {
id: 42,
name: "test tag group",
tag_names: ["monkey"],
parent_tag_name: [],
one_per_topic: false,
permissions: { everyone: 1 },
},
};
server.post("/tag_groups", () => {
return helper.response({
tag_group: {
id: 42,
name: "test tag group",
tag_names: ["monkey"],
parent_tag_name: [],
one_per_topic: false,
permissions: { everyone: 1 },
},
});
return helper.response(tagGroups);
});
server.get("/forum/tag_groups", () => {
return helper.response(tagGroups);
});
server.get("/groups/search.json", () => {
@ -82,4 +87,13 @@ acceptance("Tag Groups", function (needs) {
"selected permission does not change after saving"
);
});
test("going back to tags supports subfolder", async function (assert) {
setPrefix("/forum");
await visit("/tag_groups");
assert
.dom("a.tag-groups--back")
.hasAttribute("href", "/forum/tags", "supports subfolder");
});
});