mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-01 10:37:12 +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>
29 lines
725 B
Ruby
29 lines
725 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class DSelect < PageObjects::Components::Base
|
|
attr_reader :select_element
|
|
|
|
def initialize(input)
|
|
if input.is_a?(Capybara::Node::Element)
|
|
@select_element = input
|
|
else
|
|
@select_element = find(input)
|
|
end
|
|
end
|
|
|
|
def value
|
|
@select_element.value
|
|
end
|
|
|
|
def select(value)
|
|
@select_element.find("option[value='#{value}']").select_option
|
|
@select_element.execute_script(<<~JS, @select_element)
|
|
var selector = arguments[0];
|
|
selector.dispatchEvent(new Event("input", { bubbles: true, cancelable: true }));
|
|
JS
|
|
end
|
|
end
|
|
end
|
|
end
|