discourse/spec/system/page_objects/modals/sidebar_edit_navigation_modal.rb
chapoi f72899401d
UX: refactor .d-modal to use BEM and improve styling (#23967)
This PR refactors the following:
* leaving all the CSS applied to the old `modal-body` classes in their respective files
* made  new clean styling for `.d-modal` and refactored the template to use the new BEM classes
  * `inner-`, `middle-`, `outer-` container classes are gone and replaced with simplified `wrapper` and `container` classes  
  * use standardised max-sizes with modifiers `-large` and `-max`
  * lighter backdrop,
  * min-width to prevent puny modals
  * other styling changes regarding padding, close button,…
* pulled out all modal overrides into a general `modal-overrides` file + cleanup of outdated CSS
* pulled out login and create account modal styling into their own file, cause it's such a big override 
* removed old general login.scss file for mobile & desktop
* only kept some remainders I don't want to touch in `app/assets/stylesheets/common/base/login.scss`
2023-11-15 10:14:47 +00:00

77 lines
2.0 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Modals
class SidebarEditNavigationModal < PageObjects::Modals::Base
def closed?
has_no_css?(".sidebar__edit-navigation-menu__modal")
end
def has_right_title?(title)
has_css?(".sidebar__edit-navigation-menu__modal .d-modal__title-text", text: title)
end
def has_focus_on_filter_input?
evaluate_script("document.activeElement").native ==
find(".sidebar__edit-navigation-menu__filter-input-field").native
end
def filter(text)
find(".sidebar__edit-navigation-menu__filter-input-field").fill_in(with: text)
self
end
def click_reset_to_defaults_button
click_button(I18n.t("js.sidebar.edit_navigation_modal_form.reset_to_defaults"))
self
end
def has_no_reset_to_defaults_button?
has_no_button?(I18n.t("js.sidebar.edit_navigation_modal_form.reset_to_defaults"))
end
def save
find(".sidebar__edit-navigation-menu__save-button").click
self
end
def deselect_all
click_button(I18n.t("js.sidebar.edit_navigation_modal_form.deselect_button_text"))
self
end
def filter_by_selected
dropdown_filter.select_row_by_name(
I18n.t("js.sidebar.edit_navigation_modal_form.filter_dropdown.selected"),
)
self
end
def filter_by_unselected
dropdown_filter.select_row_by_name(
I18n.t("js.sidebar.edit_navigation_modal_form.filter_dropdown.unselected"),
)
self
end
def filter_by_all
dropdown_filter.select_row_by_name(
I18n.t("js.sidebar.edit_navigation_modal_form.filter_dropdown.all"),
)
self
end
private
def dropdown_filter
PageObjects::Components::SelectKit.new(
".sidebar__edit-navigation-menu__filter-dropdown",
).tap(&:is_not_disabled?)
end
end
end
end