2023-10-09 20:11:16 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module PageObjects
|
|
|
|
module Components
|
|
|
|
class DToggleSwitch < PageObjects::Components::Base
|
|
|
|
attr_reader :context
|
|
|
|
|
|
|
|
def initialize(context)
|
|
|
|
@context = context
|
|
|
|
end
|
|
|
|
|
|
|
|
def component
|
|
|
|
find(@context, visible: :all).native
|
|
|
|
end
|
|
|
|
|
|
|
|
def toggle
|
|
|
|
actionbuilder = page.driver.browser.action # workaround zero height button
|
|
|
|
actionbuilder.click(component).perform
|
|
|
|
end
|
2024-08-30 12:53:36 +08:00
|
|
|
|
|
|
|
def checked?
|
|
|
|
find(@context).has_css?(".d-toggle-switch__checkbox[aria-checked=\"true\"]", visible: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
def unchecked?
|
|
|
|
find(@context).has_css?(
|
|
|
|
".d-toggle-switch__checkbox[aria-checked=\"false\"]",
|
|
|
|
visible: false,
|
|
|
|
)
|
|
|
|
end
|
2023-10-09 20:11:16 +08:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|