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