mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-14 14:27:58 +08:00
Follow-up to https://github.com/discourse/discourse/pull/31887 This commit introduces a new design for the components listing page, which is not linked from anywhere in the UI at the moment, but it can be accessed by heading to the `/admin/config/customize/components` path directly. We'll make this new design available from the sidebar and remove the old page once we've tested and validated the new design internally. Internal topic: t/146007. --------- Co-authored-by: Ella <ella.estigoy@gmail.com>
47 lines
998 B
Ruby
47 lines
998 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class DMenu < PageObjects::Components::Base
|
|
attr_reader :component
|
|
|
|
def initialize(input)
|
|
if input.is_a?(Capybara::Node::Element)
|
|
@component = input
|
|
else
|
|
@component = find(input)
|
|
end
|
|
end
|
|
|
|
def expand
|
|
raise "DMenu is already expanded" if is_expanded?
|
|
component.click
|
|
end
|
|
|
|
def collapse
|
|
raise "DMenu is already collapsed" if is_collapsed?
|
|
component.click
|
|
end
|
|
|
|
def is_expanded?
|
|
component["aria-expanded"] == "true"
|
|
end
|
|
|
|
def is_collapsed?
|
|
!is_expanded?
|
|
end
|
|
|
|
def option(selector)
|
|
within("#d-menu-portals") { find(selector) }
|
|
end
|
|
|
|
def has_option?(selector)
|
|
within("#d-menu-portals") { has_css?(selector) }
|
|
end
|
|
|
|
def has_no_option?(selector)
|
|
within("#d-menu-portals") { has_no_css?(selector) }
|
|
end
|
|
end
|
|
end
|
|
end
|