DEV: Deselect all and reset to defaults btns to edit categories modal (#22143)

What does this change do?

This change adds the deselect all and reset to defaults buttons to the
edit navigation menu categories modal. The deselect all button when
click deselects all the selected categories in the modal. If the user
saves with no categories selected, the user's categories section in the
navigation menu will be set to the site's top categories.

The reset to defaults button is only shown when the
`default_navigation_menu_categories` site setting has been configured.
When clicked, the user's categories section in the navigation menu is
automatically set to the categories defined by the
`default_navigation_menu_categories` site setting.
This commit is contained in:
Alan Guo Xiang Tan
2023-06-20 08:17:53 +08:00
committed by GitHub
parent cdcf6cf0dd
commit 289d2a5540
8 changed files with 223 additions and 85 deletions

View File

@ -29,7 +29,7 @@ module PageObjects
has_no_css?(".sidebar-categories-form-modal .sidebar-categories-form__category-row") &&
has_css?(
".sidebar-categories-form-modal .sidebar-categories-form__no-categories",
text: I18n.t("js.sidebar.categories_form.no_categories"),
text: I18n.t("js.sidebar.categories_form_modal.no_categories"),
)
end
@ -65,6 +65,20 @@ module PageObjects
self
end
def deselect_all
click_button(I18n.t("js.sidebar.categories_form_modal.subtitle.button_text"))
self
end
def click_reset_to_defaults_button
click_button(I18n.t("js.sidebar.categories_form_modal.reset_to_defaults"))
self
end
def has_no_reset_to_defaults_button?
has_no_button?(I18n.t("js.sidebar.categories_form_modal.reset_to_defaults"))
end
end
end
end