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:
Alan Guo Xiang Tan 2022-09-29 14:44:41 +08:00 committed by GitHub
parent ec1851b1dc
commit 4f84ed6723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -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() {

View File

@ -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();