mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
DEV: Reorder categories in sidebar edit modal (#25792)
Sort categories by relevance instead of alphabetically.
This commit is contained in:
parent
087712c1a6
commit
9db009bf96
|
@ -72,8 +72,6 @@ export default class extends Component {
|
|||
|
||||
if (this.siteSettings.fixed_category_positions) {
|
||||
allCategories.sort((a, b) => a.position - b.position);
|
||||
} else {
|
||||
allCategories.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
this.filteredCategoriesGroupings = splitWhere(
|
||||
|
|
|
@ -55,7 +55,7 @@ RSpec.describe "Editing sidebar categories navigation", type: :system do
|
|||
expect(modal).to have_no_reset_to_defaults_button
|
||||
|
||||
expect(modal).to have_categories(
|
||||
[category, category_subcategory, category_subcategory2, category2, category2_subcategory],
|
||||
[category2, category2_subcategory, category, category_subcategory2, category_subcategory],
|
||||
)
|
||||
|
||||
modal
|
||||
|
@ -165,13 +165,13 @@ RSpec.describe "Editing sidebar categories navigation", type: :system do
|
|||
modal.filter("subcategory")
|
||||
|
||||
expect(modal).to have_categories(
|
||||
[category, category_subcategory, category_subcategory2, category2, category2_subcategory],
|
||||
[category2, category2_subcategory, category, category_subcategory2, category_subcategory],
|
||||
)
|
||||
|
||||
modal.filter("2")
|
||||
|
||||
expect(modal).to have_categories(
|
||||
[category, category_subcategory2, category2, category2_subcategory],
|
||||
[category2, category2_subcategory, category, category_subcategory2],
|
||||
)
|
||||
|
||||
modal.filter("someinvalidterm")
|
||||
|
@ -190,7 +190,7 @@ RSpec.describe "Editing sidebar categories navigation", type: :system do
|
|||
modal = sidebar.click_edit_categories_button
|
||||
modal.filter_by_selected
|
||||
|
||||
expect(modal).to have_categories([category, category_subcategory, category2])
|
||||
expect(modal).to have_categories([category2, category, category_subcategory])
|
||||
expect(modal).to have_checkbox(category, disabled: true)
|
||||
expect(modal).to have_checkbox(category_subcategory)
|
||||
expect(modal).to have_checkbox(category2)
|
||||
|
@ -215,7 +215,7 @@ RSpec.describe "Editing sidebar categories navigation", type: :system do
|
|||
modal.filter_by_all
|
||||
|
||||
expect(modal).to have_categories(
|
||||
[category, category_subcategory, category_subcategory2, category2, category2_subcategory],
|
||||
[category, category_subcategory2, category_subcategory, category2, category2_subcategory],
|
||||
)
|
||||
|
||||
expect(modal).to have_checkbox(category)
|
||||
|
@ -294,13 +294,13 @@ RSpec.describe "Editing sidebar categories navigation", type: :system do
|
|||
|
||||
expect(modal).to have_categories(
|
||||
[
|
||||
category,
|
||||
category_subcategory,
|
||||
category_subcategory_subcategory2,
|
||||
category_subcategory2,
|
||||
category2,
|
||||
category2_subcategory,
|
||||
category2_subcategory_subcategory,
|
||||
category,
|
||||
category_subcategory2,
|
||||
category_subcategory,
|
||||
category_subcategory_subcategory2,
|
||||
],
|
||||
)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user