FIX: Use `Category#category_text` for sidebar title (#18411)
Previously we used `Category#category_excerpt` but the excerpt keeps the HTML entities around if present and we can't really display HTML in the title of a link.
This commit is contained in:
parent
ec1851b1dc
commit
4f84ed6723
|
@ -41,7 +41,7 @@ export default class CategorySectionLink {
|
||||||
}
|
}
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
return this.category.description_excerpt;
|
return this.category.description_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
get text() {
|
get text() {
|
||||||
|
|
|
@ -254,6 +254,25 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("category section link have the right title", async function (assert) {
|
||||||
|
const categories = Site.current().categories;
|
||||||
|
|
||||||
|
// Category with link HTML tag in description
|
||||||
|
const category = categories.find((c) => c.id === 28);
|
||||||
|
|
||||||
|
updateCurrentUser({
|
||||||
|
sidebar_category_ids: [category.id],
|
||||||
|
});
|
||||||
|
|
||||||
|
await visit("/");
|
||||||
|
|
||||||
|
assert.strictEqual(
|
||||||
|
query(`.sidebar-section-link-${category.slug}`).title,
|
||||||
|
category.description_text,
|
||||||
|
"category description without HTML entity is used as the link's title"
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("visiting category discovery new route", async function (assert) {
|
test("visiting category discovery new route", async function (assert) {
|
||||||
const { category1 } = setupUserSidebarCategories();
|
const { category1 } = setupUserSidebarCategories();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue