mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 00:32:52 +08:00
UX: Changes in top categories of hamburger menu (#6200)
This commit is contained in:
@ -2,7 +2,6 @@ import { moduleForWidget, widgetTest } from "helpers/widget-test";
|
||||
|
||||
moduleForWidget("hamburger-menu");
|
||||
|
||||
const maxCategoriesToDisplay = 6;
|
||||
const topCategoryIds = [2, 3, 1];
|
||||
|
||||
widgetTest("prioritize faq", {
|
||||
@ -128,10 +127,17 @@ widgetTest("general links", {
|
||||
}
|
||||
});
|
||||
|
||||
let maxCategoriesToDisplay;
|
||||
|
||||
widgetTest("top categories - anonymous", {
|
||||
template: '{{mount-widget widget="hamburger-menu"}}',
|
||||
anonymous: true,
|
||||
|
||||
beforeEach() {
|
||||
this.siteSettings.hamburger_menu_categories_count = 8;
|
||||
maxCategoriesToDisplay = this.siteSettings.hamburger_menu_categories_count;
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
const count = this.site.get("categoriesByCount").length;
|
||||
const maximum =
|
||||
@ -144,15 +150,15 @@ widgetTest("top categories", {
|
||||
template: '{{mount-widget widget="hamburger-menu"}}',
|
||||
|
||||
beforeEach() {
|
||||
this.siteSettings.hamburger_menu_categories_count = 8;
|
||||
maxCategoriesToDisplay = this.siteSettings.hamburger_menu_categories_count;
|
||||
this.currentUser.set("top_category_ids", topCategoryIds);
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(find(".category-link").length, maxCategoriesToDisplay);
|
||||
|
||||
const categoriesList = this.site
|
||||
.get("categoriesByCount")
|
||||
.reject(c => c.parent_category_id);
|
||||
const categoriesList = this.site.get("categoriesByCount");
|
||||
let ids = topCategoryIds
|
||||
.concat(categoriesList.map(c => c.id))
|
||||
.uniq()
|
||||
|
Reference in New Issue
Block a user