FIX: Show featured topics for categories on mobile (#27715)
The featured topics have not been rendered correctly since2190c9b
and it has been fixed for desktop recently in commitd2a52c3
. 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}}
|
{{/if}}
|
||||||
{{#unless this.isMuted}}
|
{{#unless this.isMuted}}
|
||||||
{{#if this.showTopics}}
|
{{#if this.showTopics}}
|
||||||
{{#each this.category.topics as |t|}}
|
{{#each this.category.featuredTopics as |t|}}
|
||||||
<MobileCategoryTopic @topic={{t}} />
|
<MobileCategoryTopic @topic={{t}} />
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
}}</span>
|
}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="subcategories">
|
<div class="subcategories">
|
||||||
{{#each category.subcategories as |subCategory|}}
|
{{#each category.serializedSubcategories as |subCategory|}}
|
||||||
<ParentCategoryRow @category={{subCategory}} @showTopics={{true}} />
|
<ParentCategoryRow @category={{subCategory}} @showTopics={{true}} />
|
||||||
{{else}}
|
{{else}}
|
||||||
{{! No subcategories... so just show the parent to avoid confusion }}
|
{{! No subcategories... so just show the parent to avoid confusion }}
|
||||||
|
|
|
@ -78,7 +78,7 @@ acceptance("Categories - 'categories_with_featured_topics'", function (needs) {
|
||||||
});
|
});
|
||||||
|
|
||||||
acceptance(
|
acceptance(
|
||||||
"Categories - 'subcategories_with_featured_topics'",
|
"Categories - 'subcategories_with_featured_topics' (desktop)",
|
||||||
function (needs) {
|
function (needs) {
|
||||||
needs.settings({
|
needs.settings({
|
||||||
desktop_category_page_style: "subcategories_with_featured_topics",
|
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 () {
|
acceptance("Categories - preloadStore handling", function () {
|
||||||
const styles = [
|
const styles = [
|
||||||
"categories_only",
|
"categories_only",
|
||||||
|
|
Loading…
Reference in New Issue