add accessibility ids for end-to-end tests
This commit is contained in:
parent
17011f6d9e
commit
28355ca3c5
|
@ -90,7 +90,8 @@
|
||||||
(fn []
|
(fn []
|
||||||
(let [show-actions @show-actions]
|
(let [show-actions @show-actions]
|
||||||
[touchable-highlight
|
[touchable-highlight
|
||||||
{:on-press #(dispatch [:set-chat-ui-props {:show-actions? (not show-actions)}])}
|
{:on-press #(dispatch [:set-chat-ui-props {:show-actions? (not show-actions)}])
|
||||||
|
:accessibility-label :chat-menu}
|
||||||
[view st/action
|
[view st/action
|
||||||
(if show-actions
|
(if show-actions
|
||||||
[vi/icon :icons/dropdown-up]
|
[vi/icon :icons/dropdown-up]
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
:subtitle (members-text members)
|
:subtitle (members-text members)
|
||||||
:icon :menu_group
|
:icon :menu_group
|
||||||
:icon-opts {:width 25
|
:icon-opts {:width 25
|
||||||
:height 19}
|
:height 19}
|
||||||
;; TODO not implemented: action Members
|
;; TODO not implemented: action Members
|
||||||
:handler nil})
|
:handler nil})
|
||||||
|
|
||||||
|
@ -90,26 +90,29 @@
|
||||||
custom-icon
|
custom-icon
|
||||||
handler
|
handler
|
||||||
title
|
title
|
||||||
subtitle]
|
subtitle
|
||||||
|
accessibility-label]
|
||||||
|
:or {accessibility-label :action}
|
||||||
icon-name :icon}]
|
icon-name :icon}]
|
||||||
[touchable-highlight {:on-press (fn []
|
[touchable-highlight {:on-press (fn []
|
||||||
(dispatch [:set-chat-ui-props {:show-actions? false}])
|
(dispatch [:set-chat-ui-props {:show-actions? false}])
|
||||||
(when handler
|
(when handler
|
||||||
(handler)))}
|
(handler)))}
|
||||||
[view st/action-icon-row
|
[view {:accessibility-label accessibility-label
|
||||||
|
:style st/action-icon-row}
|
||||||
[view st/action-icon-view
|
[view st/action-icon-view
|
||||||
(or custom-icon
|
(or custom-icon
|
||||||
[icon icon-name icon-style])]
|
[icon icon-name icon-style])
|
||||||
[view st/action-view
|
[view st/action-view
|
||||||
[text {:style st/action-title
|
[text {:style st/action-title
|
||||||
:number-of-lines 1
|
:number-of-lines 1
|
||||||
:font :medium}
|
:font :medium}
|
||||||
title]
|
title]
|
||||||
(when-let [subtitle subtitle]
|
(when-let [subtitle subtitle]
|
||||||
[text {:style st/action-subtitle
|
[text {:style st/action-subtitle
|
||||||
:number-of-lines 1
|
:number-of-lines 1
|
||||||
:font :default}
|
:font :default}
|
||||||
subtitle])]]])
|
subtitle])]]]])
|
||||||
|
|
||||||
(defview actions-list-view []
|
(defview actions-list-view []
|
||||||
(letsubs [group-chat [:chat :group-chat]
|
(letsubs [group-chat [:chat :group-chat]
|
||||||
|
@ -121,8 +124,8 @@
|
||||||
(group-chat-items members public?)
|
(group-chat-items members public?)
|
||||||
(user-chat-items chat-id))]
|
(user-chat-items chat-id))]
|
||||||
[view (merge
|
[view (merge
|
||||||
(st/actions-wrapper status-bar-height)
|
(st/actions-wrapper status-bar-height)
|
||||||
(get-in platform-specific [:component-styles :actions-list-view]))
|
(get-in platform-specific [:component-styles :actions-list-view]))
|
||||||
[view st/actions-separator]
|
[view st/actions-separator]
|
||||||
[view st/actions-view
|
[view st/actions-view
|
||||||
(for [action actions]
|
(for [action actions]
|
||||||
|
|
|
@ -154,23 +154,24 @@
|
||||||
(fn [{:keys [command-width container-width]}]
|
(fn [{:keys [command-width container-width]}]
|
||||||
(when (get-in @command [:command :sequential-params])
|
(when (get-in @command [:command :sequential-params])
|
||||||
(let [{:keys [placeholder hidden type]} (get-in @command [:command :params @arg-pos])]
|
(let [{:keys [placeholder hidden type]} (get-in @command [:command :params @arg-pos])]
|
||||||
[text-input (merge {:ref #(dispatch [:set-chat-ui-props {:seq-input-ref %}])
|
[text-input (merge {:ref #(dispatch [:set-chat-ui-props {:seq-input-ref %}])
|
||||||
:style (style/seq-input-text command-width container-width)
|
:style (style/seq-input-text command-width container-width)
|
||||||
:default-value (or @seq-arg-input-text "")
|
:default-value (or @seq-arg-input-text "")
|
||||||
:on-change-text #(do (dispatch [:set-chat-seq-arg-input-text %])
|
:on-change-text #(do (dispatch [:set-chat-seq-arg-input-text %])
|
||||||
(dispatch [:load-chat-parameter-box (:command @command)])
|
(dispatch [:load-chat-parameter-box (:command @command)])
|
||||||
(dispatch [:set-chat-ui-props {:validation-messages nil}]))
|
(dispatch [:set-chat-ui-props {:validation-messages nil}]))
|
||||||
:placeholder placeholder
|
:placeholder placeholder
|
||||||
:blur-on-submit false
|
:accessibility-label :chat-request-input
|
||||||
:editable (not @sending-in-progress?)
|
:blur-on-submit false
|
||||||
:on-focus #(dispatch [:set-chat-ui-props {:show-emoji? false}])
|
:editable (not @sending-in-progress?)
|
||||||
:on-submit-editing (fn []
|
:on-focus #(dispatch [:set-chat-ui-props {:show-emoji? false}])
|
||||||
(when-not (or (str/blank? @seq-arg-input-text)
|
:on-submit-editing (fn []
|
||||||
(get-in @command [:command :hide-send-button]))
|
(when-not (or (str/blank? @seq-arg-input-text)
|
||||||
(dispatch [:send-seq-argument]))
|
(get-in @command [:command :hide-send-button]))
|
||||||
(js/setTimeout
|
(dispatch [:send-seq-argument]))
|
||||||
#(dispatch [:chat-input-focus :seq-input-ref])
|
(js/setTimeout
|
||||||
100))}
|
#(dispatch [:chat-input-focus :seq-input-ref])
|
||||||
|
100))}
|
||||||
(get-options type))])))))
|
(get-options type))])))))
|
||||||
|
|
||||||
(defn input-view [_]
|
(defn input-view [_]
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
(when (and extended? (not (empty? extend-options)))
|
(when (and extended? (not (empty? extend-options)))
|
||||||
[view st/more-btn-container
|
[view st/more-btn-container
|
||||||
[context-menu
|
[context-menu
|
||||||
[vi/icon :icons/options]
|
[vi/icon :icons/options {:accessibility-label :options}]
|
||||||
extend-options
|
extend-options
|
||||||
nil
|
nil
|
||||||
st/more-btn]])]]])
|
st/more-btn]])]]])
|
||||||
|
|
|
@ -75,25 +75,27 @@
|
||||||
|
|
||||||
(defn icon
|
(defn icon
|
||||||
([name] (icon name nil))
|
([name] (icon name nil))
|
||||||
([name {:keys [color container-style style]}]
|
([name {:keys [color container-style style accessibility-label]
|
||||||
[react/view {:style container-style}
|
:or {accessibility-label :icon}}]
|
||||||
|
[react/view {:style container-style
|
||||||
|
:accessibility-label accessibility-label}
|
||||||
(if-let [icon-fn (get icons (normalize-property-name name))]
|
(if-let [icon-fn (get icons (normalize-property-name name))]
|
||||||
(into []
|
(into []
|
||||||
(concat
|
(concat
|
||||||
[svg (merge default-viewbox style)]
|
[svg (merge default-viewbox style)]
|
||||||
(icon-fn
|
(icon-fn
|
||||||
(cond
|
(cond
|
||||||
(keyword? color)
|
(keyword? color)
|
||||||
(case color
|
(case color
|
||||||
:dark styles/icon-dark-color
|
:dark styles/icon-dark-color
|
||||||
:gray styles/icon-gray-color
|
:gray styles/icon-gray-color
|
||||||
:blue styles/color-light-blue
|
:blue styles/color-light-blue
|
||||||
:active styles/color-blue4
|
:active styles/color-blue4
|
||||||
:white styles/color-white
|
:white styles/color-white
|
||||||
:red styles/icon-red-color
|
:red styles/icon-red-color
|
||||||
styles/icon-dark-color)
|
styles/icon-dark-color)
|
||||||
(string? color)
|
(string? color)
|
||||||
color
|
color
|
||||||
:else
|
:else
|
||||||
styles/icon-dark-color))))
|
styles/icon-dark-color))))
|
||||||
(throw (js/Error. (str "Unknown icon: " name))))]))
|
(throw (js/Error. (str "Unknown icon: " name))))]))
|
|
@ -61,12 +61,13 @@
|
||||||
:search-placeholder (i18n/label :t/search-for)}]))
|
:search-placeholder (i18n/label :t/search-for)}]))
|
||||||
|
|
||||||
(defn chats-action-button []
|
(defn chats-action-button []
|
||||||
[native-action-button {:button-color color-blue
|
[native-action-button {:button-color color-blue
|
||||||
:offset-x 16
|
:offset-x 16
|
||||||
:offset-y 40
|
:offset-y 40
|
||||||
:spacing 13
|
:spacing 13
|
||||||
:hide-shadow true
|
:hide-shadow true
|
||||||
:on-press #(re-frame/dispatch [:navigate-to :new-chat])}])
|
:accessibility-label :plus-button
|
||||||
|
:on-press #(re-frame/dispatch [:navigate-to :new-chat])}])
|
||||||
|
|
||||||
(defn chat-list-item [[chat-id chat] edit?]
|
(defn chat-list-item [[chat-id chat] edit?]
|
||||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to :chat chat-id])}
|
[react/touchable-highlight {:on-press #(re-frame/dispatch [:navigate-to :chat chat-id])}
|
||||||
|
|
|
@ -109,9 +109,10 @@
|
||||||
:hide-shadow true
|
:hide-shadow true
|
||||||
:spacing 13}
|
:spacing 13}
|
||||||
[native-action-button-item
|
[native-action-button-item
|
||||||
{:title (label :t/new-contact)
|
{:title (label :t/new-contact)
|
||||||
:buttonColor :#9b59b6
|
:accessibility-label :new-contact
|
||||||
:onPress #(dispatch [:navigate-to :new-contact])}
|
:buttonColor :#9b59b6
|
||||||
|
:onPress #(dispatch [:navigate-to :new-contact])}
|
||||||
[ion-icon {:name :md-create
|
[ion-icon {:name :md-create
|
||||||
:style create-icon}]]])
|
:style create-icon}]]])
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,11 @@
|
||||||
|
|
||||||
(defn contact-extended-options [group-id]
|
(defn contact-extended-options [group-id]
|
||||||
(fn [item]
|
(fn [item]
|
||||||
[{:value #(dispatch [:remove-contact-from-group
|
[{:value #(dispatch [:remove-contact-from-group
|
||||||
(:whisper-identity item)
|
(:whisper-identity item)
|
||||||
group-id])
|
group-id])
|
||||||
:text (label :t/remove-from-group)}]))
|
:accessibility-label :remove-button
|
||||||
|
:text (label :t/remove-from-group)}]))
|
||||||
|
|
||||||
(defview edit-chat-group-contact-list []
|
(defview edit-chat-group-contact-list []
|
||||||
(letsubs [chat-name [:chat :name]
|
(letsubs [chat-name [:chat :name]
|
||||||
|
@ -69,8 +70,7 @@
|
||||||
(contact-extended-options group-id)]))
|
(contact-extended-options group-id)]))
|
||||||
|
|
||||||
(defview edit-contact-group-contact-list []
|
(defview edit-contact-group-contact-list []
|
||||||
(letsubs [group [:get-contact-group]
|
(letsubs [group [:get-contact-group]]
|
||||||
type [:get-group-type]]
|
|
||||||
[view styles/group-container
|
[view styles/group-container
|
||||||
[status-bar]
|
[status-bar]
|
||||||
[contact-list-toolbar (:name group)]
|
[contact-list-toolbar (:name group)]
|
||||||
|
|
Loading…
Reference in New Issue