discourse/spec/system/page_objects/components/d_toggle_switch.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
708 B
Ruby
Raw Normal View History

# 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