discourse/spec/system/page_objects/components/select_kit.rb
Joffrey JAFFEUX 2535381f44
FIX: ensures tag notification level is changed (#21106)
Following a change in e9f7262813 which prevents the notification level to be returned from the update endpoint, the model couldn't update itself. This commit makes the update manually and adds a test to prevent future regressions.

Note we could also change the backend endpoint, but this should work correctly with minimum risk.
2023-04-17 10:48:41 +02:00

48 lines
1.0 KiB
Ruby

# frozen_string_literal: true
module PageObjects
module Components
class SelectKit < PageObjects::Components::Base
attr_reader :element
def initialize(element)
@element = element
end
def is_expanded?
element.has_css?(".is-expanded")
end
def is_collapsed?
element.has_css?(":not(.is-expanded)")
end
def has_selected_value?(value)
element.find(".select-kit-header[data-value='#{value}']")
end
def has_selected_name?(value)
element.find(".select-kit-header[data-name='#{value}']")
end
def expand
element.find(":not(.is-expanded) .select-kit-header").click
end
def collapse
element.find(".is-expanded .select-kit-header").click
end
def select_row_by_value(value)
expand
element.find(".select-kit-row[data-value='#{value}']").click
end
def select_row_by_name(name)
expand
element.find(".select-kit-row[data-name='#{name}']").click
end
end
end
end