mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-01 19:00:38 +08:00
This commit replaces the "enabled" checkbox on the automation page with a toggle at the top of the automation page. We've made this change to make the automation edit page consistent with the automations list page where a toggle is used for turning on/off automations, and also consistent with the rest of admin pages where we've been using toggle for controlling the enable/disable state. Internal topic: t/153523.
41 lines
1 KiB
Ruby
41 lines
1 KiB
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
|
|
|
|
def disabled?
|
|
label_component.has_css?(".d-toggle-switch__checkbox[disabled]", visible: :all)
|
|
end
|
|
|
|
def enabled?
|
|
label_component.has_no_css?(".d-toggle-switch__checkbox[disabled]", visible: :all) &&
|
|
label_component.has_css?(".d-toggle-switch__checkbox", visible: :all)
|
|
end
|
|
end
|
|
end
|
|
end
|