From 2c23ab4c5d35f7ff6611a20583f52fcdb721f90e Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 15 Dec 2021 18:55:32 +0200 Subject: [PATCH] [#12867] Add accessibility IDs to toggles for e2e --- src/quo/components/controls/view.cljs | 14 +++++++------- src/status_im/ui/components/checkbox/view.cljs | 4 +++- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/quo/components/controls/view.cljs b/src/quo/components/controls/view.cljs index 0a3daeeb0b..e7ad70cafe 100644 --- a/src/quo/components/controls/view.cljs +++ b/src/quo/components/controls/view.cljs @@ -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}]]]) diff --git a/src/status_im/ui/components/checkbox/view.cljs b/src/status_im/ui/components/checkbox/view.cljs index 2ba5bc1ef9..7b9b7fac28 100644 --- a/src/status_im/ui/components/checkbox/view.cljs +++ b/src/status_im/ui/components/checkbox/view.cljs @@ -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?