(target: any)
| 2156 | } |
| 2157 | |
| 2158 | function actionsFor(target: any): string[] { |
| 2159 | const native = nativeTarget(target); |
| 2160 | const actions = new Set(["describe", "getProperties", "setProperty"]); |
| 2161 | if ( |
| 2162 | isKindOf(native, "UIControl") || |
| 2163 | Boolean(read(native, "isAccessibilityElement")) |
| 2164 | ) { |
| 2165 | actions.add("tap"); |
| 2166 | } |
| 2167 | if (Boolean(read(native, "canBecomeFirstResponder"))) { |
| 2168 | actions.add("focus"); |
| 2169 | } |
| 2170 | if (Boolean(read(native, "isFirstResponder"))) { |
| 2171 | actions.add("resignFirstResponder"); |
| 2172 | } |
| 2173 | if (isKindOf(native, "UITextField") || isKindOf(native, "UITextView")) { |
| 2174 | actions.add("setText"); |
| 2175 | } |
| 2176 | if (isKindOf(native, "UISwitch")) { |
| 2177 | actions.add("toggle"); |
| 2178 | actions.add("setValue"); |
| 2179 | } |
| 2180 | if (isKindOf(native, "UISlider") || isKindOf(native, "UISegmentedControl")) { |
| 2181 | actions.add("setValue"); |
| 2182 | } |
| 2183 | if (isKindOf(native, "UIScrollView")) { |
| 2184 | actions.add("scrollBy"); |
| 2185 | actions.add("scrollTo"); |
| 2186 | } |
| 2187 | if (Boolean(read(native, "isAccessibilityElement"))) { |
| 2188 | actions.add("accessibilityActivate"); |
| 2189 | } |
| 2190 | return [...actions].sort(); |
| 2191 | } |
| 2192 | |
| 2193 | function editablePropertiesFor(target: any): string[] { |
| 2194 | const properties = new Set(defaultEditableProperties); |
no test coverage detected