discourse/spec/system/page_objects/components/d_select.rb
Osama Sayegh ad0966afa9
FEATURE: Introduce new components listing page (#32164)
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>
2025-04-08 17:58:29 +03:00

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