mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 08:03:40 +08:00
33 lines
708 B
Ruby
33 lines
708 B
Ruby
# frozen_string_literal: true
|
|
|
|
module PageObjects
|
|
module Components
|
|
class DToggleSwitch < PageObjects::Components::Base
|
|
attr_reader :context
|
|
|
|
def initialize(context)
|
|
@context = context
|
|
end
|
|
|
|
def label_component
|
|
find(context, visible: :all).ancestor("label.d-toggle-switch__label")
|
|
end
|
|
|
|
def toggle
|
|
label_component.click
|
|
end
|
|
|
|
def checked?
|
|
label_component.has_css?(".d-toggle-switch__checkbox[aria-checked=\"true\"]", visible: :all)
|
|
end
|
|
|
|
def unchecked?
|
|
label_component.has_css?(
|
|
".d-toggle-switch__checkbox[aria-checked=\"false\"]",
|
|
visible: :all,
|
|
)
|
|
end
|
|
end
|
|
end
|
|
end
|