mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 21:42:40 +08:00
2535381f44
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.
48 lines
1.0 KiB
Ruby
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
|