mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Avoid a hacky workaround in d-toggle-switch specs (#29376)
This commit is contained in:
parent
d471c01ff6
commit
44d1a818a3
@ -37,7 +37,7 @@ describe "Admin Plugins List", type: :system, js: true do
|
|||||||
toggle_switch =
|
toggle_switch =
|
||||||
PageObjects::Components::DToggleSwitch.new(
|
PageObjects::Components::DToggleSwitch.new(
|
||||||
admin_plugins_list_page.plugin_row_selector("automation") +
|
admin_plugins_list_page.plugin_row_selector("automation") +
|
||||||
" .admin-plugins-list__enabled .d-toggle-switch",
|
" .admin-plugins-list__enabled .d-toggle-switch__checkbox",
|
||||||
)
|
)
|
||||||
toggle_switch.toggle
|
toggle_switch.toggle
|
||||||
expect(toggle_switch).to be_unchecked
|
expect(toggle_switch).to be_unchecked
|
||||||
|
@ -9,23 +9,22 @@ module PageObjects
|
|||||||
@context = context
|
@context = context
|
||||||
end
|
end
|
||||||
|
|
||||||
def component
|
def label_component
|
||||||
find(@context, visible: :all).native
|
find(context, visible: :all).ancestor("label.d-toggle-switch__label")
|
||||||
end
|
end
|
||||||
|
|
||||||
def toggle
|
def toggle
|
||||||
actionbuilder = page.driver.browser.action # workaround zero height button
|
label_component.click
|
||||||
actionbuilder.click(component).perform
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def checked?
|
def checked?
|
||||||
find(@context).has_css?(".d-toggle-switch__checkbox[aria-checked=\"true\"]", visible: false)
|
label_component.has_css?(".d-toggle-switch__checkbox[aria-checked=\"true\"]", visible: :all)
|
||||||
end
|
end
|
||||||
|
|
||||||
def unchecked?
|
def unchecked?
|
||||||
find(@context).has_css?(
|
label_component.has_css?(
|
||||||
".d-toggle-switch__checkbox[aria-checked=\"false\"]",
|
".d-toggle-switch__checkbox[aria-checked=\"false\"]",
|
||||||
visible: false,
|
visible: :all,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user