[#12867] Add accessibility IDs to toggles for e2e
This commit is contained in:
parent
646add59b8
commit
2c23ab4c5d
|
@ -49,15 +49,15 @@
|
|||
:hold hold
|
||||
:disabled disabled}]]]))))
|
||||
|
||||
(defn switch-view [{:keys [transition hold disabled]}]
|
||||
(defn switch-view [{:keys [transition hold disabled value]}]
|
||||
[animated/view {:style (styles/switch-style transition disabled)
|
||||
:accessibility-label :switch
|
||||
:accessibility-label (str "switch-" (if value "on" "off"))
|
||||
:accessibility-role :switch}
|
||||
[animated/view {:style (styles/switch-bullet-style transition hold)}]])
|
||||
|
||||
(defn radio-view [{:keys [transition hold disabled]}]
|
||||
(defn radio-view [{:keys [transition hold disabled value]}]
|
||||
[animated/view {:style (styles/radio-style transition disabled)
|
||||
:accessibility-label :radio
|
||||
:accessibility-label (str "radio-" (if value "on" "off"))
|
||||
:accessibility-role :radio}
|
||||
[animated/view {:style (styles/radio-bullet-style transition hold)}]])
|
||||
|
||||
|
@ -67,15 +67,15 @@
|
|||
[rn/touchable-without-feedback
|
||||
{:on-press (when (and onChange (not disabled)) onChange)}
|
||||
[rn/view {:style (styles/checkbox-style value disabled)
|
||||
:accessibility-label :checkbox
|
||||
:accessibility-label (str "checkbox-" (if value "on" "off"))
|
||||
:accessibility-role :checkbox}
|
||||
[rn/view {:style (styles/check-icon-style value)}
|
||||
[icons/tiny-icon :tiny-icons/tiny-check {:color colors/white}]]]])))
|
||||
|
||||
(defn animated-checkbox-view [{:keys [transition hold disabled]}]
|
||||
(defn animated-checkbox-view [{:keys [transition hold disabled value]}]
|
||||
[animated/view
|
||||
{:style (styles/animated-checkbox-style transition disabled)
|
||||
:accessibility-label :checkbox
|
||||
:accessibility-label (str "checkbox-" (if value "on" "off"))
|
||||
:accessibility-role :checkbox}
|
||||
[animated/view {:style (styles/animated-check-icon-style transition hold)}
|
||||
[icons/tiny-icon :tiny-icons/tiny-check {:color colors/white}]]])
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
(merge {:style (merge
|
||||
styles/wrapper
|
||||
style)
|
||||
:accessibility-label accessibility-label}
|
||||
:accessibility-label (str accessibility-label
|
||||
"-"
|
||||
(if checked? "on" "off"))}
|
||||
(when on-value-change
|
||||
{:on-press #(on-value-change (not checked?))}))
|
||||
(if checked?
|
||||
|
|
Loading…
Reference in New Issue