mirror of
https://github.com/discourse/discourse.git
synced 2025-03-31 04:11:57 +08:00
FIX: Show featured topics for categories on mobile (#27715)
The featured topics have not been rendered correctly since 2190c9b and it has been fixed for desktop recently in commit d2a52c3. This commit implements similar changes that initialize Category and Topic object instances from the serialized data.
This commit is contained in:
parent
1bc18a5bf4
commit
487fb1da22
@ -25,7 +25,7 @@
|
||||
{{/if}}
|
||||
{{#unless this.isMuted}}
|
||||
{{#if this.showTopics}}
|
||||
{{#each this.category.topics as |t|}}
|
||||
{{#each this.category.featuredTopics as |t|}}
|
||||
<MobileCategoryTopic @topic={{t}} />
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
@ -7,7 +7,7 @@
|
||||
}}</span>
|
||||
</div>
|
||||
<div class="subcategories">
|
||||
{{#each category.subcategories as |subCategory|}}
|
||||
{{#each category.serializedSubcategories as |subCategory|}}
|
||||
<ParentCategoryRow @category={{subCategory}} @showTopics={{true}} />
|
||||
{{else}}
|
||||
{{! No subcategories... so just show the parent to avoid confusion }}
|
||||
|
@ -78,7 +78,7 @@ acceptance("Categories - 'categories_with_featured_topics'", function (needs) {
|
||||
});
|
||||
|
||||
acceptance(
|
||||
"Categories - 'subcategories_with_featured_topics'",
|
||||
"Categories - 'subcategories_with_featured_topics' (desktop)",
|
||||
function (needs) {
|
||||
needs.settings({
|
||||
desktop_category_page_style: "subcategories_with_featured_topics",
|
||||
@ -103,6 +103,33 @@ acceptance(
|
||||
}
|
||||
);
|
||||
|
||||
acceptance(
|
||||
"Categories - 'subcategories_with_featured_topics' (mobile)",
|
||||
function (needs) {
|
||||
needs.mobileView();
|
||||
needs.settings({
|
||||
desktop_category_page_style: "subcategories_with_featured_topics",
|
||||
});
|
||||
test("basic functionality", async function (assert) {
|
||||
await visit("/categories");
|
||||
assert.ok(
|
||||
exists("div.subcategory-list.with-topics h3 .category-name"),
|
||||
"shows heading for top-level category"
|
||||
);
|
||||
assert.ok(
|
||||
exists(
|
||||
"div.subcategory-list.with-topics div[data-category-id=26] h3 .category-name"
|
||||
),
|
||||
"shows element for subcategories"
|
||||
);
|
||||
assert.ok(
|
||||
exists("div.category-list.with-topics a[data-topic-id=11994]"),
|
||||
"shows a featured topic"
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
acceptance("Categories - preloadStore handling", function () {
|
||||
const styles = [
|
||||
"categories_only",
|
||||
|
Loading…
x
Reference in New Issue
Block a user