@testing-library/react-native 12.2.0 → 12.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (283) hide show
  1. package/.DS_Store +0 -0
  2. package/.eslintcache +1 -1
  3. package/.eslintignore +1 -0
  4. package/build/fireEvent.js +1 -1
  5. package/build/fireEvent.js.map +1 -1
  6. package/build/helpers/component-tree.d.ts +11 -5
  7. package/build/helpers/component-tree.js +5 -1
  8. package/build/helpers/component-tree.js.map +1 -1
  9. package/build/helpers/findAll.d.ts +2 -1
  10. package/build/helpers/findAll.js +2 -1
  11. package/build/helpers/findAll.js.map +1 -1
  12. package/build/helpers/host-component-names.d.ts +11 -2
  13. package/build/helpers/host-component-names.js +10 -0
  14. package/build/helpers/host-component-names.js.map +1 -1
  15. package/build/helpers/matchers/matchLabelText.js +1 -1
  16. package/build/helpers/matchers/matchLabelText.js.map +1 -1
  17. package/build/queries/a11yState.js +1 -1
  18. package/build/queries/a11yState.js.map +1 -1
  19. package/build/queries/a11yValue.js +1 -1
  20. package/build/queries/a11yValue.js.map +1 -1
  21. package/build/queries/displayValue.js +5 -6
  22. package/build/queries/displayValue.js.map +1 -1
  23. package/build/queries/hintText.js +1 -1
  24. package/build/queries/hintText.js.map +1 -1
  25. package/build/queries/labelText.js +1 -1
  26. package/build/queries/labelText.js.map +1 -1
  27. package/build/queries/placeholderText.js +3 -4
  28. package/build/queries/placeholderText.js.map +1 -1
  29. package/build/queries/role.js +1 -1
  30. package/build/queries/role.js.map +1 -1
  31. package/build/queries/testId.js +3 -3
  32. package/build/queries/testId.js.map +1 -1
  33. package/build/queries/text.js +1 -2
  34. package/build/queries/text.js.map +1 -1
  35. package/build/render.js.map +1 -1
  36. package/build/user-event/clear.d.ts +3 -0
  37. package/build/user-event/clear.js +41 -0
  38. package/build/user-event/clear.js.map +1 -0
  39. package/build/user-event/index.d.ts +1 -0
  40. package/build/user-event/index.js +2 -1
  41. package/build/user-event/index.js.map +1 -1
  42. package/build/user-event/press/press.js +1 -4
  43. package/build/user-event/press/press.js.map +1 -1
  44. package/build/user-event/setup/setup.d.ts +14 -2
  45. package/build/user-event/setup/setup.js +3 -1
  46. package/build/user-event/setup/setup.js.map +1 -1
  47. package/build/user-event/type/type.d.ts +2 -1
  48. package/build/user-event/type/type.js +8 -4
  49. package/build/user-event/type/type.js.map +1 -1
  50. package/build/user-event/utils/host-components.d.ts +2 -0
  51. package/build/user-event/utils/host-components.js +11 -0
  52. package/build/user-event/utils/host-components.js.map +1 -0
  53. package/build/user-event/utils/index.d.ts +1 -0
  54. package/build/user-event/utils/index.js +11 -0
  55. package/build/user-event/utils/index.js.map +1 -1
  56. package/build/user-event/utils/text-range.d.ts +0 -1
  57. package/build/user-event/utils/text-range.js +0 -11
  58. package/build/user-event/utils/text-range.js.map +1 -1
  59. package/examples/basic/.expo/README.md +4 -6
  60. package/examples/basic/.expo/settings.json +2 -0
  61. package/examples/basic/__tests__/App.test.tsx +30 -12
  62. package/examples/basic/package.json +1 -1
  63. package/examples/basic/yarn.lock +2095 -3474
  64. package/examples/react-navigation/yarn.lock +1657 -2249
  65. package/examples/redux/yarn.lock +1772 -5376
  66. package/experiments-app/.expo/packager-info.json +9 -0
  67. package/experiments-app/.expo/settings.json +1 -2
  68. package/experiments-app/package.json +7 -9
  69. package/experiments-app/src/MainScreen.tsx +1 -0
  70. package/experiments-app/src/experiments.ts +20 -2
  71. package/experiments-app/src/screens/FlatListEvents.tsx +57 -0
  72. package/experiments-app/src/screens/ScrollViewEvents.tsx +65 -0
  73. package/experiments-app/src/screens/SectionListEvents.tsx +91 -0
  74. package/experiments-app/src/screens/TextInputEventPropagation.tsx +5 -17
  75. package/experiments-app/src/screens/TextInputEvents.tsx +13 -25
  76. package/experiments-app/src/utils/helpers.ts +13 -3
  77. package/experiments-app/yarn.lock +901 -1105
  78. package/experiments-rtl/.babelrc +8 -0
  79. package/experiments-rtl/.eslintrc.json +3 -0
  80. package/experiments-rtl/.gitignore +35 -0
  81. package/experiments-rtl/README.md +34 -0
  82. package/experiments-rtl/jest-setup.js +1 -0
  83. package/experiments-rtl/jest.config.js +4 -0
  84. package/experiments-rtl/next.config.js +4 -0
  85. package/experiments-rtl/package.json +38 -0
  86. package/experiments-rtl/postcss.config.js +6 -0
  87. package/experiments-rtl/public/next.svg +1 -0
  88. package/experiments-rtl/public/vercel.svg +1 -0
  89. package/experiments-rtl/src/app/__tests__/click.test.tsx +31 -0
  90. package/experiments-rtl/src/app/__tests__/managed-text-input.test.tsx +51 -0
  91. package/experiments-rtl/src/app/globals.css +27 -0
  92. package/experiments-rtl/src/app/layout.tsx +22 -0
  93. package/experiments-rtl/src/app/page.tsx +113 -0
  94. package/experiments-rtl/tailwind.config.ts +20 -0
  95. package/experiments-rtl/tsconfig.json +28 -0
  96. package/experiments-rtl/yarn.lock +5418 -0
  97. package/package.json +4 -2
  98. package/src/fireEvent.ts +1 -1
  99. package/src/helpers/component-tree.ts +14 -9
  100. package/src/helpers/findAll.ts +6 -4
  101. package/src/helpers/host-component-names.tsx +15 -2
  102. package/src/helpers/matchers/matchLabelText.ts +0 -1
  103. package/src/queries/a11yState.ts +2 -6
  104. package/src/queries/a11yValue.ts +2 -6
  105. package/src/queries/displayValue.ts +7 -14
  106. package/src/queries/hintText.ts +2 -7
  107. package/src/queries/labelText.ts +1 -3
  108. package/src/queries/placeholderText.ts +6 -13
  109. package/src/queries/role.ts +1 -2
  110. package/src/queries/testId.ts +5 -10
  111. package/src/queries/text.ts +3 -6
  112. package/src/render.tsx +1 -1
  113. package/src/user-event/__tests__/__snapshots__/clear.test.tsx.snap +269 -0
  114. package/src/user-event/__tests__/clear.test.tsx +217 -0
  115. package/src/user-event/clear.ts +59 -0
  116. package/src/user-event/index.ts +1 -0
  117. package/src/user-event/press/press.ts +8 -14
  118. package/src/user-event/setup/setup.ts +17 -2
  119. package/src/user-event/type/__tests__/type-managed.test.tsx +0 -1
  120. package/src/user-event/type/__tests__/type.test.tsx +0 -1
  121. package/src/user-event/type/type.ts +16 -13
  122. package/src/user-event/utils/__tests__/wait.test.ts +0 -1
  123. package/src/user-event/utils/host-components.ts +6 -0
  124. package/src/user-event/utils/index.ts +1 -0
  125. package/src/user-event/utils/text-range.ts +0 -7
  126. package/website/docs/Queries.md +64 -59
  127. package/website/docs/UserEvent.md +48 -0
  128. package/build/helpers/filterNodeByType.d.ts +0 -3
  129. package/build/helpers/filterNodeByType.js +0 -9
  130. package/build/helpers/filterNodeByType.js.map +0 -1
  131. package/coverage/clover.xml +0 -1176
  132. package/coverage/coverage-final.json +0 -70
  133. package/coverage/lcov-report/base.css +0 -224
  134. package/coverage/lcov-report/block-navigation.js +0 -87
  135. package/coverage/lcov-report/favicon.png +0 -0
  136. package/coverage/lcov-report/index.html +0 -266
  137. package/coverage/lcov-report/prettify.css +0 -1
  138. package/coverage/lcov-report/prettify.js +0 -2
  139. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  140. package/coverage/lcov-report/sorter.js +0 -196
  141. package/coverage/lcov-report/src/act.ts.html +0 -343
  142. package/coverage/lcov-report/src/cleanup.ts.html +0 -130
  143. package/coverage/lcov-report/src/config.ts.html +0 -301
  144. package/coverage/lcov-report/src/fireEvent.ts.html +0 -559
  145. package/coverage/lcov-report/src/flushMicroTasks.ts.html +0 -124
  146. package/coverage/lcov-report/src/helpers/accessiblity.ts.html +0 -412
  147. package/coverage/lcov-report/src/helpers/component-tree.ts.html +0 -352
  148. package/coverage/lcov-report/src/helpers/debugDeep.ts.html +0 -166
  149. package/coverage/lcov-report/src/helpers/debugShallow.ts.html +0 -151
  150. package/coverage/lcov-report/src/helpers/deprecation.ts.html +0 -244
  151. package/coverage/lcov-report/src/helpers/errors.ts.html +0 -283
  152. package/coverage/lcov-report/src/helpers/filterNodeByType.ts.html +0 -106
  153. package/coverage/lcov-report/src/helpers/findAll.ts.html +0 -289
  154. package/coverage/lcov-report/src/helpers/format-default.ts.html +0 -301
  155. package/coverage/lcov-report/src/helpers/format.ts.html +0 -226
  156. package/coverage/lcov-report/src/helpers/getTextContent.ts.html +0 -145
  157. package/coverage/lcov-report/src/helpers/host-component-names.tsx.html +0 -286
  158. package/coverage/lcov-report/src/helpers/index.html +0 -326
  159. package/coverage/lcov-report/src/helpers/matchers/accessibilityState.ts.html +0 -229
  160. package/coverage/lcov-report/src/helpers/matchers/accessibilityValue.ts.html +0 -157
  161. package/coverage/lcov-report/src/helpers/matchers/index.html +0 -206
  162. package/coverage/lcov-report/src/helpers/matchers/matchArrayProp.ts.html +0 -148
  163. package/coverage/lcov-report/src/helpers/matchers/matchLabelText.ts.html +0 -238
  164. package/coverage/lcov-report/src/helpers/matchers/matchObjectProp.ts.html +0 -160
  165. package/coverage/lcov-report/src/helpers/matchers/matchStringProp.ts.html +0 -154
  166. package/coverage/lcov-report/src/helpers/matchers/matchTextContent.ts.html +0 -145
  167. package/coverage/lcov-report/src/helpers/query-name.ts.html +0 -97
  168. package/coverage/lcov-report/src/helpers/stringValidation.ts.html +0 -193
  169. package/coverage/lcov-report/src/helpers/timers.ts.html +0 -382
  170. package/coverage/lcov-report/src/index.html +0 -356
  171. package/coverage/lcov-report/src/index.ts.html +0 -184
  172. package/coverage/lcov-report/src/matches.ts.html +0 -232
  173. package/coverage/lcov-report/src/pure.ts.html +0 -157
  174. package/coverage/lcov-report/src/queries/a11yState.ts.html +0 -478
  175. package/coverage/lcov-report/src/queries/a11yValue.ts.html +0 -478
  176. package/coverage/lcov-report/src/queries/displayValue.ts.html +0 -319
  177. package/coverage/lcov-report/src/queries/hintText.ts.html +0 -421
  178. package/coverage/lcov-report/src/queries/index.html +0 -281
  179. package/coverage/lcov-report/src/queries/labelText.ts.html +0 -262
  180. package/coverage/lcov-report/src/queries/makeQueries.ts.html +0 -850
  181. package/coverage/lcov-report/src/queries/placeholderText.ts.html +0 -322
  182. package/coverage/lcov-report/src/queries/role.ts.html +0 -481
  183. package/coverage/lcov-report/src/queries/testId.ts.html +0 -298
  184. package/coverage/lcov-report/src/queries/text.ts.html +0 -283
  185. package/coverage/lcov-report/src/queries/unsafeProps.ts.html +0 -313
  186. package/coverage/lcov-report/src/queries/unsafeType.ts.html +0 -304
  187. package/coverage/lcov-report/src/react-versions.ts.html +0 -118
  188. package/coverage/lcov-report/src/render-act.ts.html +0 -142
  189. package/coverage/lcov-report/src/render.tsx.html +0 -592
  190. package/coverage/lcov-report/src/renderHook.tsx.html +0 -262
  191. package/coverage/lcov-report/src/screen.ts.html +0 -454
  192. package/coverage/lcov-report/src/shallow.ts.html +0 -139
  193. package/coverage/lcov-report/src/test-utils/events.ts.html +0 -145
  194. package/coverage/lcov-report/src/test-utils/index.html +0 -131
  195. package/coverage/lcov-report/src/test-utils/index.ts.html +0 -88
  196. package/coverage/lcov-report/src/user-event/event-builder/common.ts.html +0 -229
  197. package/coverage/lcov-report/src/user-event/event-builder/index.html +0 -146
  198. package/coverage/lcov-report/src/user-event/event-builder/index.ts.html +0 -106
  199. package/coverage/lcov-report/src/user-event/event-builder/test-input.ts.html +0 -343
  200. package/coverage/lcov-report/src/user-event/event-builder/text-input.ts.html +0 -343
  201. package/coverage/lcov-report/src/user-event/index.html +0 -116
  202. package/coverage/lcov-report/src/user-event/index.ts.html +0 -121
  203. package/coverage/lcov-report/src/user-event/press/index.html +0 -131
  204. package/coverage/lcov-report/src/user-event/press/index.ts.html +0 -88
  205. package/coverage/lcov-report/src/user-event/press/press.ts.html +0 -133
  206. package/coverage/lcov-report/src/user-event/setup/index.html +0 -131
  207. package/coverage/lcov-report/src/user-event/setup/index.ts.html +0 -91
  208. package/coverage/lcov-report/src/user-event/setup/setup.ts.html +0 -358
  209. package/coverage/lcov-report/src/user-event/type/index.html +0 -146
  210. package/coverage/lcov-report/src/user-event/type/index.ts.html +0 -88
  211. package/coverage/lcov-report/src/user-event/type/parseKeys.ts.html +0 -208
  212. package/coverage/lcov-report/src/user-event/type/type.ts.html +0 -484
  213. package/coverage/lcov-report/src/user-event/utils/content-size.ts.html +0 -160
  214. package/coverage/lcov-report/src/user-event/utils/dispatch-event.ts.html +0 -367
  215. package/coverage/lcov-report/src/user-event/utils/events.ts.html +0 -247
  216. package/coverage/lcov-report/src/user-event/utils/index.html +0 -176
  217. package/coverage/lcov-report/src/user-event/utils/index.ts.html +0 -97
  218. package/coverage/lcov-report/src/user-event/utils/text-range.ts.html +0 -118
  219. package/coverage/lcov-report/src/user-event/utils/wait.ts.html +0 -130
  220. package/coverage/lcov-report/src/waitFor.ts.html +0 -772
  221. package/coverage/lcov-report/src/waitForElementToBeRemoved.ts.html +0 -211
  222. package/coverage/lcov-report/src/within.ts.html +0 -175
  223. package/coverage/lcov.info +0 -2614
  224. package/examples/.DS_Store +0 -0
  225. package/examples/basic/.expo/devices.json +0 -3
  226. package/examples/basic/yarn-error.log +0 -8083
  227. package/examples/redux/yarn-error.log +0 -8083
  228. package/src/.DS_Store +0 -0
  229. package/src/__tests__/.DS_Store +0 -0
  230. package/src/helpers/filterNodeByType.ts +0 -7
  231. package/website/.DS_Store +0 -0
  232. package/website/.docusaurus/DONT-EDIT-THIS-FOLDER +0 -5
  233. package/website/.docusaurus/client-modules.js +0 -6
  234. package/website/.docusaurus/codeTranslations.json +0 -1
  235. package/website/.docusaurus/docusaurus-plugin-content-blog/default/blog-post-list-prop-default.json +0 -4
  236. package/website/.docusaurus/docusaurus-plugin-content-blog/default/plugin-route-context-module-100.json +0 -4
  237. package/website/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json +0 -4
  238. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-api-md-c82.json +0 -27
  239. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-eslint-p-llugin-testing-library-md-d24.json +0 -27
  240. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-faq-md-ad8.json +0 -27
  241. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-getting-started-md-8a6.json +0 -23
  242. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-how-should-i-query-md-f2d.json +0 -27
  243. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-11-md-add.json +0 -27
  244. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-12-md-14f.json +0 -27
  245. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-2-md-698.json +0 -27
  246. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-7-md-6bb.json +0 -27
  247. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-migration-v-9-md-f69.json +0 -27
  248. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-queries-md-7ad.json +0 -27
  249. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-react-navigation-md-1bd.json +0 -27
  250. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-redux-integration-md-77b.json +0 -23
  251. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-testing-environment-md-1c6.json +0 -27
  252. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-troubleshooting-md-01d.json +0 -27
  253. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-understanding-act-md-aa9.json +0 -27
  254. package/website/.docusaurus/docusaurus-plugin-content-docs/default/site-docs-user-event-md-501.json +0 -27
  255. package/website/.docusaurus/docusaurus-plugin-content-docs/default/version-current-metadata-prop-751.json +0 -268
  256. package/website/.docusaurus/docusaurus-plugin-content-docs/react-native-testing-library-docs-route-96e.json +0 -115
  257. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-api-md-c82.json +0 -19
  258. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-eslint-p-llugin-testing-library-md-d24.json +0 -19
  259. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-faq-md-ad8.json +0 -19
  260. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-getting-started-md-8a6.json +0 -15
  261. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-how-should-i-query-md-f2d.json +0 -19
  262. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-11-md-add.json +0 -19
  263. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-2-md-698.json +0 -19
  264. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-7-md-6bb.json +0 -19
  265. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-migration-v-9-md-f69.json +0 -19
  266. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-queries-md-7ad.json +0 -19
  267. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-react-navigation-md-1bd.json +0 -19
  268. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-redux-integration-md-77b.json +0 -15
  269. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-troubleshooting-md-01d.json +0 -19
  270. package/website/.docusaurus/docusaurus-plugin-content-docs/site-docs-understanding-act-md-aa9.json +0 -19
  271. package/website/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json +0 -4
  272. package/website/.docusaurus/docusaurus-plugin-debug/default/docusaurus-debug-all-content-673.json +0 -623
  273. package/website/.docusaurus/docusaurus-plugin-debug/default/plugin-route-context-module-100.json +0 -4
  274. package/website/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json +0 -4
  275. package/website/.docusaurus/docusaurus.config.js +0 -267
  276. package/website/.docusaurus/docusaurus.config.mjs +0 -365
  277. package/website/.docusaurus/globalData.json +0 -113
  278. package/website/.docusaurus/i18n.json +0 -17
  279. package/website/.docusaurus/registry.js +0 -35
  280. package/website/.docusaurus/routes.js +0 -162
  281. package/website/.docusaurus/routesChunkNames.json +0 -133
  282. package/website/.docusaurus/site-metadata.json +0 -36
  283. package/yarn-error.log +0 -10613
@@ -8,6 +8,10 @@ exports.getHostParent = getHostParent;
8
8
  exports.getHostSelves = getHostSelves;
9
9
  exports.getHostSiblings = getHostSiblings;
10
10
  exports.isHostElement = isHostElement;
11
+ /**
12
+ * ReactTestInstance referring to host element.
13
+ */
14
+
11
15
  /**
12
16
  * Checks if the given element is a host element.
13
17
  * @param element The element to check.
@@ -64,7 +68,7 @@ function getHostChildren(element) {
64
68
  * if the passed element is a composite element, it will return an array containing its host children (zero, one or many).
65
69
  */
66
70
  function getHostSelves(element) {
67
- return typeof element?.type === 'string' ? [element] : getHostChildren(element);
71
+ return isHostElement(element) ? [element] : getHostChildren(element);
68
72
  }
69
73
 
70
74
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"component-tree.js","names":["isHostElement","element","type","getHostParent","current","parent","getHostChildren","hostChildren","children","forEach","child","push","getHostSelves","getHostSiblings","hostParent","hostSelves","filter","sibling","includes"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isHostElement(element?: ReactTestInstance | null) {\n return typeof element?.type === 'string';\n}\n\n/**\n * Returns first host ancestor for given element.\n * @param element The element start traversing from.\n */\nexport function getHostParent(\n element: ReactTestInstance | null\n): ReactTestInstance | null {\n if (element == null) {\n return null;\n }\n\n let current = element.parent;\n while (current) {\n if (isHostElement(current)) {\n return current;\n }\n\n current = current.parent;\n }\n\n return null;\n}\n\n/**\n * Returns host children for given element.\n * @param element The element start traversing from.\n */\nexport function getHostChildren(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n if (element == null) {\n return [];\n }\n\n const hostChildren: ReactTestInstance[] = [];\n\n element.children.forEach((child) => {\n if (typeof child !== 'object') {\n return;\n }\n\n if (isHostElement(child)) {\n hostChildren.push(child);\n } else {\n hostChildren.push(...getHostChildren(child));\n }\n });\n\n return hostChildren;\n}\n\n/**\n * Return the array of host elements that represent the passed element.\n *\n * @param element The element start traversing from.\n * @returns If the passed element is a host element, it will return an array containing only that element,\n * if the passed element is a composite element, it will return an array containing its host children (zero, one or many).\n */\nexport function getHostSelves(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n return typeof element?.type === 'string'\n ? [element]\n : getHostChildren(element);\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(\n element: ReactTestInstance | null\n): ReactTestInstance[] {\n const hostParent = getHostParent(element);\n const hostSelves = getHostSelves(element);\n return getHostChildren(hostParent).filter(\n (sibling) => !hostSelves.includes(sibling)\n );\n}\n"],"mappings":";;;;;;;;;;AAEA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,OAAkC,EAAE;EAChE,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ;AAC1C;;AAEA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAC3BF,OAAiC,EACP;EAC1B,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,IAAIG,OAAO,GAAGH,OAAO,CAACI,MAAM;EAC5B,OAAOD,OAAO,EAAE;IACd,IAAIJ,aAAa,CAACI,OAAO,CAAC,EAAE;MAC1B,OAAOA,OAAO;IAChB;IAEAA,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BL,OAAiC,EACZ;EACrB,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,EAAE;EACX;EAEA,MAAMM,YAAiC,GAAG,EAAE;EAE5CN,OAAO,CAACO,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAClC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IAEA,IAAIV,aAAa,CAACU,KAAK,CAAC,EAAE;MACxBH,YAAY,CAACI,IAAI,CAACD,KAAK,CAAC;IAC1B,CAAC,MAAM;MACLH,YAAY,CAACI,IAAI,CAAC,GAAGL,eAAe,CAACI,KAAK,CAAC,CAAC;IAC9C;EACF,CAAC,CAAC;EAEF,OAAOH,YAAY;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,aAAaA,CAC3BX,OAAiC,EACZ;EACrB,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,GACpC,CAACD,OAAO,CAAC,GACTK,eAAe,CAACL,OAAO,CAAC;AAC9B;;AAEA;AACA;AACA;AACA;AACO,SAASY,eAAeA,CAC7BZ,OAAiC,EACZ;EACrB,MAAMa,UAAU,GAAGX,aAAa,CAACF,OAAO,CAAC;EACzC,MAAMc,UAAU,GAAGH,aAAa,CAACX,OAAO,CAAC;EACzC,OAAOK,eAAe,CAACQ,UAAU,CAAC,CAACE,MAAM,CACtCC,OAAO,IAAK,CAACF,UAAU,CAACG,QAAQ,CAACD,OAAO,CAC3C,CAAC;AACH"}
1
+ {"version":3,"file":"component-tree.js","names":["isHostElement","element","type","getHostParent","current","parent","getHostChildren","hostChildren","children","forEach","child","push","getHostSelves","getHostSiblings","hostParent","hostSelves","filter","sibling","includes"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\n\n/**\n * ReactTestInstance referring to host element.\n */\nexport type HostTestInstance = ReactTestInstance & { type: string };\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isHostElement(\n element?: ReactTestInstance | null\n): element is HostTestInstance {\n return typeof element?.type === 'string';\n}\n\n/**\n * Returns first host ancestor for given element.\n * @param element The element start traversing from.\n */\nexport function getHostParent(\n element: ReactTestInstance | null\n): HostTestInstance | null {\n if (element == null) {\n return null;\n }\n\n let current = element.parent;\n while (current) {\n if (isHostElement(current)) {\n return current;\n }\n\n current = current.parent;\n }\n\n return null;\n}\n\n/**\n * Returns host children for given element.\n * @param element The element start traversing from.\n */\nexport function getHostChildren(\n element: ReactTestInstance | null\n): HostTestInstance[] {\n if (element == null) {\n return [];\n }\n\n const hostChildren: HostTestInstance[] = [];\n\n element.children.forEach((child) => {\n if (typeof child !== 'object') {\n return;\n }\n\n if (isHostElement(child)) {\n hostChildren.push(child);\n } else {\n hostChildren.push(...getHostChildren(child));\n }\n });\n\n return hostChildren;\n}\n\n/**\n * Return the array of host elements that represent the passed element.\n *\n * @param element The element start traversing from.\n * @returns If the passed element is a host element, it will return an array containing only that element,\n * if the passed element is a composite element, it will return an array containing its host children (zero, one or many).\n */\nexport function getHostSelves(\n element: ReactTestInstance | null\n): HostTestInstance[] {\n return isHostElement(element) ? [element] : getHostChildren(element);\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(\n element: ReactTestInstance | null\n): HostTestInstance[] {\n const hostParent = getHostParent(element);\n const hostSelves = getHostSelves(element);\n return getHostChildren(hostParent).filter(\n (sibling) => !hostSelves.includes(sibling)\n );\n}\n"],"mappings":";;;;;;;;;;AAEA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAC3BC,OAAkC,EACL;EAC7B,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ;AAC1C;;AAEA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAC3BF,OAAiC,EACR;EACzB,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,IAAIG,OAAO,GAAGH,OAAO,CAACI,MAAM;EAC5B,OAAOD,OAAO,EAAE;IACd,IAAIJ,aAAa,CAACI,OAAO,CAAC,EAAE;MAC1B,OAAOA,OAAO;IAChB;IAEAA,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAO,IAAI;AACb;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAC7BL,OAAiC,EACb;EACpB,IAAIA,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,EAAE;EACX;EAEA,MAAMM,YAAgC,GAAG,EAAE;EAE3CN,OAAO,CAACO,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAClC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IAEA,IAAIV,aAAa,CAACU,KAAK,CAAC,EAAE;MACxBH,YAAY,CAACI,IAAI,CAACD,KAAK,CAAC;IAC1B,CAAC,MAAM;MACLH,YAAY,CAACI,IAAI,CAAC,GAAGL,eAAe,CAACI,KAAK,CAAC,CAAC;IAC9C;EACF,CAAC,CAAC;EAEF,OAAOH,YAAY;AACrB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,aAAaA,CAC3BX,OAAiC,EACb;EACpB,OAAOD,aAAa,CAACC,OAAO,CAAC,GAAG,CAACA,OAAO,CAAC,GAAGK,eAAe,CAACL,OAAO,CAAC;AACtE;;AAEA;AACA;AACA;AACA;AACO,SAASY,eAAeA,CAC7BZ,OAAiC,EACb;EACpB,MAAMa,UAAU,GAAGX,aAAa,CAACF,OAAO,CAAC;EACzC,MAAMc,UAAU,GAAGH,aAAa,CAACX,OAAO,CAAC;EACzC,OAAOK,eAAe,CAACQ,UAAU,CAAC,CAACE,MAAM,CACtCC,OAAO,IAAK,CAACF,UAAU,CAACG,QAAQ,CAACD,OAAO,CAC3C,CAAC;AACH"}
@@ -1,4 +1,5 @@
1
1
  import { ReactTestInstance } from 'react-test-renderer';
2
+ import { HostTestInstance } from './component-tree';
2
3
  interface FindAllOptions {
3
4
  /** Match elements hidden from accessibility */
4
5
  includeHiddenElements?: boolean;
@@ -6,5 +7,5 @@ interface FindAllOptions {
6
7
  hidden?: boolean;
7
8
  matchDeepestOnly?: boolean;
8
9
  }
9
- export declare function findAll(root: ReactTestInstance, predicate: (element: ReactTestInstance) => boolean, options?: FindAllOptions): ReactTestInstance[];
10
+ export declare function findAll(root: ReactTestInstance, predicate: (element: ReactTestInstance) => boolean, options?: FindAllOptions): HostTestInstance[];
10
11
  export {};
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.findAll = findAll;
7
7
  var _config = require("../config");
8
8
  var _accessiblity = require("./accessiblity");
9
+ var _componentTree = require("./component-tree");
9
10
  function findAll(root, predicate, options) {
10
11
  const results = findAllInternal(root, predicate, options);
11
12
  const includeHiddenElements = options?.includeHiddenElements ?? options?.hidden ?? (0, _config.getConfig)()?.defaultIncludeHiddenElements;
@@ -33,7 +34,7 @@ function findAllInternal(root, predicate, options) {
33
34
  });
34
35
  if (
35
36
  // When matchDeepestOnly = true: add current element only if no descendants match
36
- (!options?.matchDeepestOnly || matchingDescendants.length === 0) && predicate(root)) {
37
+ (!options?.matchDeepestOnly || matchingDescendants.length === 0) && (0, _componentTree.isHostElement)(root) && predicate(root)) {
37
38
  results.push(root);
38
39
  }
39
40
 
@@ -1 +1 @@
1
- {"version":3,"file":"findAll.js","names":["_config","require","_accessiblity","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length"],"sources":["../../src/helpers/findAll.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessiblity';\n\ninterface FindAllOptions {\n /** Match elements hidden from accessibility */\n includeHiddenElements?: boolean;\n\n /** RTL-compatible alias to `includeHiddenElements` */\n hidden?: boolean;\n\n /* Exclude any ancestors of deepest matched elements even if they match the predicate */\n matchDeepestOnly?: boolean;\n}\n\nexport function findAll(\n root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n) {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ??\n options?.hidden ??\n getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<ReactTestInstance>();\n return results.filter(\n (element) => !isHiddenFromAccessibility(element, { cache })\n );\n}\n\n// Extracted from React Test Renderer\n// src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402\nfunction findAllInternal(\n root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n): Array<ReactTestInstance> {\n const results: ReactTestInstance[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: ReactTestInstance[] = [];\n root.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n predicate(root)\n ) {\n results.push(root);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAaO,SAASE,OAAOA,CACrBC,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACxB;EACA,MAAMC,OAAO,GAAGC,eAAe,CAACJ,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAEzD,MAAMG,qBAAqB,GACzBH,OAAO,EAAEG,qBAAqB,IAC9BH,OAAO,EAAEI,MAAM,IACf,IAAAC,iBAAS,EAAC,CAAC,EAAEC,4BAA4B;EAE3C,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,CAAoB,CAAC;EAC9C,OAAOP,OAAO,CAACQ,MAAM,CAClBC,OAAO,IAAK,CAAC,IAAAC,uCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAC5D,CAAC;AACH;;AAEA;AACA;AACA,SAASL,eAAeA,CACtBJ,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACE;EAC1B,MAAMC,OAA4B,GAAG,EAAE;;EAEvC;EACA,MAAMW,mBAAwC,GAAG,EAAE;EACnDd,IAAI,CAACe,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC/B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IACAH,mBAAmB,CAACI,IAAI,CAAC,GAAGd,eAAe,CAACa,KAAK,EAAEhB,SAAS,EAAEC,OAAO,CAAC,CAAC;EACzE,CAAC,CAAC;EAEF;EACE;EACA,CAAC,CAACA,OAAO,EAAEiB,gBAAgB,IAAIL,mBAAmB,CAACM,MAAM,KAAK,CAAC,KAC/DnB,SAAS,CAACD,IAAI,CAAC,EACf;IACAG,OAAO,CAACe,IAAI,CAAClB,IAAI,CAAC;EACpB;;EAEA;EACAG,OAAO,CAACe,IAAI,CAAC,GAAGJ,mBAAmB,CAAC;EAEpC,OAAOX,OAAO;AAChB"}
1
+ {"version":3,"file":"findAll.js","names":["_config","require","_accessiblity","_componentTree","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length","isHostElement"],"sources":["../../src/helpers/findAll.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessiblity';\nimport { HostTestInstance, isHostElement } from './component-tree';\n\ninterface FindAllOptions {\n /** Match elements hidden from accessibility */\n includeHiddenElements?: boolean;\n\n /** RTL-compatible alias to `includeHiddenElements` */\n hidden?: boolean;\n\n /* Exclude any ancestors of deepest matched elements even if they match the predicate */\n matchDeepestOnly?: boolean;\n}\n\nexport function findAll(\n root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n): HostTestInstance[] {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ??\n options?.hidden ??\n getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<ReactTestInstance>();\n return results.filter(\n (element) => !isHiddenFromAccessibility(element, { cache })\n );\n}\n\n// Extracted from React Test Renderer\n// src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402\nfunction findAllInternal(\n root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n): HostTestInstance[] {\n const results: HostTestInstance[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostTestInstance[] = [];\n root.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n isHostElement(root) &&\n predicate(root)\n ) {\n results.push(root);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAaO,SAASG,OAAOA,CACrBC,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACJ;EACpB,MAAMC,OAAO,GAAGC,eAAe,CAACJ,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAEzD,MAAMG,qBAAqB,GACzBH,OAAO,EAAEG,qBAAqB,IAC9BH,OAAO,EAAEI,MAAM,IACf,IAAAC,iBAAS,EAAC,CAAC,EAAEC,4BAA4B;EAE3C,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,CAAoB,CAAC;EAC9C,OAAOP,OAAO,CAACQ,MAAM,CAClBC,OAAO,IAAK,CAAC,IAAAC,uCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAC5D,CAAC;AACH;;AAEA;AACA;AACA,SAASL,eAAeA,CACtBJ,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACJ;EACpB,MAAMC,OAA2B,GAAG,EAAE;;EAEtC;EACA,MAAMW,mBAAuC,GAAG,EAAE;EAClDd,IAAI,CAACe,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC/B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IACAH,mBAAmB,CAACI,IAAI,CAAC,GAAGd,eAAe,CAACa,KAAK,EAAEhB,SAAS,EAAEC,OAAO,CAAC,CAAC;EACzE,CAAC,CAAC;EAEF;EACE;EACA,CAAC,CAACA,OAAO,EAAEiB,gBAAgB,IAAIL,mBAAmB,CAACM,MAAM,KAAK,CAAC,KAC/D,IAAAC,4BAAa,EAACrB,IAAI,CAAC,IACnBC,SAAS,CAACD,IAAI,CAAC,EACf;IACAG,OAAO,CAACe,IAAI,CAAClB,IAAI,CAAC;EACpB;;EAEA;EACAG,OAAO,CAACe,IAAI,CAAC,GAAGJ,mBAAmB,CAAC;EAEpC,OAAOX,OAAO;AAChB"}
@@ -1,6 +1,15 @@
1
1
  import { ReactTestInstance } from 'react-test-renderer';
2
2
  import { HostComponentNames } from '../config';
3
+ import { HostTestInstance } from './component-tree';
3
4
  export declare function getHostComponentNames(): HostComponentNames;
4
5
  export declare function configureHostComponentNamesIfNeeded(): void;
5
- export declare function isHostText(element?: ReactTestInstance): boolean;
6
- export declare function isHostTextInput(element?: ReactTestInstance): boolean;
6
+ /**
7
+ * Checks if the given element is a host Text.
8
+ * @param element The element to check.
9
+ */
10
+ export declare function isHostText(element?: ReactTestInstance | null): element is HostTestInstance;
11
+ /**
12
+ * Checks if the given element is a host TextInput.
13
+ * @param element The element to check.
14
+ */
15
+ export declare function isHostTextInput(element?: ReactTestInstance | null): element is HostTestInstance;
@@ -61,9 +61,19 @@ function getByTestId(instance, testID) {
61
61
  }
62
62
  return nodes[0];
63
63
  }
64
+
65
+ /**
66
+ * Checks if the given element is a host Text.
67
+ * @param element The element to check.
68
+ */
64
69
  function isHostText(element) {
65
70
  return element?.type === getHostComponentNames().text;
66
71
  }
72
+
73
+ /**
74
+ * Checks if the given element is a host TextInput.
75
+ * @param element The element to check.
76
+ */
67
77
  function isHostTextInput(element) {
68
78
  return element?.type === getHostComponentNames().textInput;
69
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"host-component-names.js","names":["React","_interopRequireWildcard","require","_reactNative","_config","_renderAct","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","userConfigErrorMessage","getHostComponentNames","hostComponentNames","getConfig","detectHostComponentNames","configureInternal","configureHostComponentNamesIfNeeded","configHostComponentNames","renderer","renderWithAct","createElement","View","Text","testID","TextInput","Switch","text","getByTestId","root","type","textInput","switch","error","errorMessage","message","Error","instance","nodes","findAll","node","props","length","isHostText","element","isHostTextInput"],"sources":["../../src/helpers/host-component-names.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { Switch, Text, TextInput, View } from 'react-native';\nimport { configureInternal, getConfig, HostComponentNames } from '../config';\nimport { renderWithAct } from '../render-act';\n\nconst userConfigErrorMessage = `There seems to be an issue with your configuration that prevents React Native Testing Library from working correctly.\nPlease check if you are using compatible versions of React Native and React Native Testing Library.`;\n\nexport function getHostComponentNames(): HostComponentNames {\n let hostComponentNames = getConfig().hostComponentNames;\n if (!hostComponentNames) {\n hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n }\n\n return hostComponentNames;\n}\n\nexport function configureHostComponentNamesIfNeeded() {\n const configHostComponentNames = getConfig().hostComponentNames;\n if (configHostComponentNames) {\n return;\n }\n\n const hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n}\n\nfunction detectHostComponentNames(): HostComponentNames {\n try {\n const renderer = renderWithAct(\n <View>\n <Text testID=\"text\">Hello</Text>\n <TextInput testID=\"textInput\" />\n <Switch testID=\"switch\" />\n </View>\n );\n\n return {\n text: getByTestId(renderer.root, 'text').type as string,\n textInput: getByTestId(renderer.root, 'textInput').type as string,\n switch: getByTestId(renderer.root, 'switch').type as string,\n };\n } catch (error) {\n const errorMessage =\n error && typeof error === 'object' && 'message' in error\n ? error.message\n : null;\n\n throw new Error(\n `Trying to detect host component names triggered the following error:\\n\\n${errorMessage}\\n\\n${userConfigErrorMessage}`\n );\n }\n}\n\nfunction getByTestId(instance: ReactTestInstance, testID: string) {\n const nodes = instance.findAll(\n (node) => typeof node.type === 'string' && node.props.testID === testID\n );\n\n if (nodes.length === 0) {\n throw new Error(`Unable to find an element with testID: ${testID}`);\n }\n\n return nodes[0];\n}\n\nexport function isHostText(element?: ReactTestInstance) {\n return element?.type === getHostComponentNames().text;\n}\n\nexport function isHostTextInput(element?: ReactTestInstance) {\n return element?.type === getHostComponentNames().textInput;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA8C,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAN,wBAAAU,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WA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Ed,IAAI,KAAKlB,qBAAqB,CAAC,CAAC,CAACe,IAAI;AACvD;AAEO,SAASkB,eAAeA,CAACD,OAA2B,EAAE;EAC3D,OAAOA,OAAO,EAAEd,IAAI,KAAKlB,qBAAqB,CAAC,CAAC,CAACmB,SAAS;AAC5D"}
1
+ {"version":3,"file":"host-component-names.js","names":["React","_interopRequireWildcard","require","_reactNative","_config","_renderAct","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","userConfigErrorMessage","getHostComponentNames","hostComponentNames","getConfig","detectHostComponentNames","configureInternal","configureHostComponentNamesIfNeeded","configHostComponentNames","renderer","renderWithAct","createElement","View","Text","testID","TextInput","Switch","text","getByTestId","root","type","textInput","switch","error","errorMessage","message","Error","instance","nodes","findAll","node","props","length","isHostText","element","isHostTextInput"],"sources":["../../src/helpers/host-component-names.tsx"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { Switch, Text, TextInput, View } from 'react-native';\nimport { configureInternal, getConfig, HostComponentNames } from '../config';\nimport { renderWithAct } from '../render-act';\nimport { HostTestInstance } from './component-tree';\n\nconst userConfigErrorMessage = `There seems to be an issue with your configuration that prevents React Native Testing Library from working correctly.\nPlease check if you are using compatible versions of React Native and React Native Testing Library.`;\n\nexport function getHostComponentNames(): HostComponentNames {\n let hostComponentNames = getConfig().hostComponentNames;\n if (!hostComponentNames) {\n hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n }\n\n return hostComponentNames;\n}\n\nexport function configureHostComponentNamesIfNeeded() {\n const configHostComponentNames = getConfig().hostComponentNames;\n if (configHostComponentNames) {\n return;\n }\n\n const hostComponentNames = detectHostComponentNames();\n configureInternal({ hostComponentNames });\n}\n\nfunction detectHostComponentNames(): HostComponentNames {\n try {\n const renderer = renderWithAct(\n <View>\n <Text testID=\"text\">Hello</Text>\n <TextInput testID=\"textInput\" />\n <Switch testID=\"switch\" />\n </View>\n );\n\n return {\n text: getByTestId(renderer.root, 'text').type as string,\n textInput: getByTestId(renderer.root, 'textInput').type as string,\n switch: getByTestId(renderer.root, 'switch').type as string,\n };\n } catch (error) {\n const errorMessage =\n error && typeof error === 'object' && 'message' in error\n ? error.message\n : null;\n\n throw new Error(\n `Trying to detect host component names triggered the following error:\\n\\n${errorMessage}\\n\\n${userConfigErrorMessage}`\n );\n }\n}\n\nfunction getByTestId(instance: ReactTestInstance, testID: string) {\n const nodes = instance.findAll(\n (node) => typeof node.type === 'string' && node.props.testID === testID\n );\n\n if (nodes.length === 0) {\n throw new Error(`Unable to find an element with testID: ${testID}`);\n }\n\n return nodes[0];\n}\n\n/**\n * Checks if the given element is a host Text.\n * @param element The element to check.\n */\nexport function isHostText(\n element?: ReactTestInstance | null\n): element is HostTestInstance {\n return element?.type === getHostComponentNames().text;\n}\n\n/**\n * Checks if the given element is a host TextInput.\n * @param element The element to check.\n */\nexport function isHostTextInput(\n element?: ReactTestInstance | null\n): element is HostTestInstance {\n return element?.type === getHostComponentNames().textInput;\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA8C,SAAAI,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAN,wBAAAU,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BA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AAM,KAAKA,MACnE,CAAC;EAED,IAAIc,KAAK,CAACI,MAAM,KAAK,CAAC,EAAE;IACtB,MAAM,IAAIN,KAAK,CAAE,0CAAyCZ,MAAO,EAAC,CAAC;EACrE;EAEA,OAAOc,KAAK,CAAC,CAAC,CAAC;AACjB;;AAEA;AACA;AACA;AACA;AACO,SAASK,UAAUA,CACxBC,OAAkC,EACL;EAC7B,OAAOA,OAAO,EAAEd,IAAI,KAAKlB,qBAAqB,CAAC,CAAC,CAACe,IAAI;AACvD;;AAEA;AACA;AACA;AACA;AACO,SAASkB,eAAeA,CAC7BD,OAAkC,EACL;EAC7B,OAAOA,OAAO,EAAEd,IAAI,KAAKlB,qBAAqB,CAAC,CAAC,CAACmB,SAAS;AAC5D"}
@@ -21,6 +21,6 @@ function matchAccessibilityLabelledBy(root, nativeId, text, options) {
21
21
  if (!nativeId) {
22
22
  return false;
23
23
  }
24
- return (0, _findAll.findAll)(root, node => typeof node.type === 'string' && node.props.nativeID === nativeId && (0, _matchTextContent.matchTextContent)(node, text, options)).length > 0;
24
+ return (0, _findAll.findAll)(root, node => node.props.nativeID === nativeId && (0, _matchTextContent.matchTextContent)(node, text, options)).length > 0;
25
25
  }
26
26
  //# sourceMappingURL=matchLabelText.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"matchLabelText.js","names":["_matches","require","_findAll","_matchTextContent","matchLabelText","root","element","text","options","matchAccessibilityLabel","matchAccessibilityLabelledBy","props","accessibilityLabelledBy","exact","normalizer","matches","accessibilityLabel","nativeId","findAll","node","type","nativeID","matchTextContent","length"],"sources":["../../../src/helpers/matchers/matchLabelText.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { findAll } from '../findAll';\nimport { matchTextContent } from './matchTextContent';\n\nexport function matchLabelText(\n root: ReactTestInstance,\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) {\n return (\n matchAccessibilityLabel(element, text, options) ||\n matchAccessibilityLabelledBy(\n root,\n element.props.accessibilityLabelledBy,\n text,\n options\n )\n );\n}\n\nfunction matchAccessibilityLabel(\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions\n) {\n const { exact, normalizer } = options;\n return matches(text, element.props.accessibilityLabel, normalizer, exact);\n}\n\nfunction matchAccessibilityLabelledBy(\n root: ReactTestInstance,\n nativeId: string | undefined,\n text: TextMatch,\n options: TextMatchOptions\n) {\n if (!nativeId) {\n return false;\n }\n\n return (\n findAll(\n root,\n (node) =>\n typeof node.type === 'string' &&\n node.props.nativeID === nativeId &&\n matchTextContent(node, text, options)\n ).length > 0\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEO,SAASG,cAAcA,CAC5BC,IAAuB,EACvBC,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,OACEC,uBAAuB,CAACH,OAAO,EAAEC,IAAI,EAAEC,OAAO,CAAC,IAC/CE,4BAA4B,CAC1BL,IAAI,EACJC,OAAO,CAACK,KAAK,CAACC,uBAAuB,EACrCL,IAAI,EACJC,OACF,CAAC;AAEL;AAEA,SAASC,uBAAuBA,CAC9BH,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,EACzB;EACA,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGN,OAAO;EACrC,OAAO,IAAAO,gBAAO,EAACR,IAAI,EAAED,OAAO,CAACK,KAAK,CAACK,kBAAkB,EAAEF,UAAU,EAAED,KAAK,CAAC;AAC3E;AAEA,SAASH,4BAA4BA,CACnCL,IAAuB,EACvBY,QAA4B,EAC5BV,IAAe,EACfC,OAAyB,EACzB;EACA,IAAI,CAACS,QAAQ,EAAE;IACb,OAAO,KAAK;EACd;EAEA,OACE,IAAAC,gBAAO,EACLb,IAAI,EACHc,IAAI,IACH,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAC7BD,IAAI,CAACR,KAAK,CAACU,QAAQ,KAAKJ,QAAQ,IAChC,IAAAK,kCAAgB,EAACH,IAAI,EAAEZ,IAAI,EAAEC,OAAO,CACxC,CAAC,CAACe,MAAM,GAAG,CAAC;AAEhB"}
1
+ {"version":3,"file":"matchLabelText.js","names":["_matches","require","_findAll","_matchTextContent","matchLabelText","root","element","text","options","matchAccessibilityLabel","matchAccessibilityLabelledBy","props","accessibilityLabelledBy","exact","normalizer","matches","accessibilityLabel","nativeId","findAll","node","nativeID","matchTextContent","length"],"sources":["../../../src/helpers/matchers/matchLabelText.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { findAll } from '../findAll';\nimport { matchTextContent } from './matchTextContent';\n\nexport function matchLabelText(\n root: ReactTestInstance,\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) {\n return (\n matchAccessibilityLabel(element, text, options) ||\n matchAccessibilityLabelledBy(\n root,\n element.props.accessibilityLabelledBy,\n text,\n options\n )\n );\n}\n\nfunction matchAccessibilityLabel(\n element: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions\n) {\n const { exact, normalizer } = options;\n return matches(text, element.props.accessibilityLabel, normalizer, exact);\n}\n\nfunction matchAccessibilityLabelledBy(\n root: ReactTestInstance,\n nativeId: string | undefined,\n text: TextMatch,\n options: TextMatchOptions\n) {\n if (!nativeId) {\n return false;\n }\n\n return (\n findAll(\n root,\n (node) =>\n node.props.nativeID === nativeId &&\n matchTextContent(node, text, options)\n ).length > 0\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAEO,SAASG,cAAcA,CAC5BC,IAAuB,EACvBC,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,OACEC,uBAAuB,CAACH,OAAO,EAAEC,IAAI,EAAEC,OAAO,CAAC,IAC/CE,4BAA4B,CAC1BL,IAAI,EACJC,OAAO,CAACK,KAAK,CAACC,uBAAuB,EACrCL,IAAI,EACJC,OACF,CAAC;AAEL;AAEA,SAASC,uBAAuBA,CAC9BH,OAA0B,EAC1BC,IAAe,EACfC,OAAyB,EACzB;EACA,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGN,OAAO;EACrC,OAAO,IAAAO,gBAAO,EAACR,IAAI,EAAED,OAAO,CAACK,KAAK,CAACK,kBAAkB,EAAEF,UAAU,EAAED,KAAK,CAAC;AAC3E;AAEA,SAASH,4BAA4BA,CACnCL,IAAuB,EACvBY,QAA4B,EAC5BV,IAAe,EACfC,OAAyB,EACzB;EACA,IAAI,CAACS,QAAQ,EAAE;IACb,OAAO,KAAK;EACd;EAEA,OACE,IAAAC,gBAAO,EACLb,IAAI,EACHc,IAAI,IACHA,IAAI,CAACR,KAAK,CAACS,QAAQ,KAAKH,QAAQ,IAChC,IAAAI,kCAAgB,EAACF,IAAI,EAAEZ,IAAI,EAAEC,OAAO,CACxC,CAAC,CAACc,MAAM,GAAG,CAAC;AAEhB"}
@@ -10,7 +10,7 @@ var _findAll = require("../helpers/findAll");
10
10
  var _accessibilityState = require("../helpers/matchers/accessibilityState");
11
11
  var _makeQueries = require("./makeQueries");
12
12
  const queryAllByA11yState = instance => function queryAllByA11yStateFn(matcher, queryOptions) {
13
- return (0, _findAll.findAll)(instance, node => typeof node.type === 'string' && (0, _accessibilityState.matchAccessibilityState)(node, matcher), queryOptions);
13
+ return (0, _findAll.findAll)(instance, node => (0, _accessibilityState.matchAccessibilityState)(node, matcher), queryOptions);
14
14
  };
15
15
  const buildErrorMessage = (state = {}) => {
16
16
  const errors = [];
@@ -1 +1 @@
1
- {"version":3,"file":"a11yState.js","names":["_accessiblity","require","_deprecation","_findAll","_accessibilityState","_makeQueries","queryAllByA11yState","instance","queryAllByA11yStateFn","matcher","queryOptions","findAll","node","type","matchAccessibilityState","buildErrorMessage","state","errors","accessibilityStateKeys","forEach","stateKey","undefined","push","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByA11yStateQueries","getByA11yState","getAllByA11yState","queryByA11yState","findByA11yState","findAllByA11yState","deprecateQueries","getByAccessibilityState","getAllByAccessibilityState","queryByAccessibilityState","queryAllByAccessibilityState","findByAccessibilityState","findAllByAccessibilityState","exports"],"sources":["../../src/queries/a11yState.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\nconst queryAllByA11yState = (\n instance: ReactTestInstance\n): ((\n matcher: AccessibilityStateMatcher,\n queryOptions?: CommonQueryOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByA11yStateFn(matcher, queryOptions) {\n return findAll(\n instance,\n (node) =>\n typeof node.type === 'string' && matchAccessibilityState(node, matcher),\n queryOptions\n );\n };\n\nconst buildErrorMessage = (state: AccessibilityStateMatcher = {}) => {\n const errors: string[] = [];\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (state[stateKey] !== undefined) {\n errors.push(`${stateKey} state: ${state[stateKey]}`);\n }\n });\n\n return errors.join(', ');\n};\n\nconst getMultipleError = (state: AccessibilityStateMatcher) =>\n `Found multiple elements with ${buildErrorMessage(state)}`;\n\nconst getMissingError = (state: AccessibilityStateMatcher) =>\n `Unable to find an element with ${buildErrorMessage(state)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByA11yState,\n getMissingError,\n getMultipleError\n);\n\nexport type ByA11yStateQueries = {\n getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n getAllByA11yState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByA11yState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryAllByA11yState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByA11yState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findAllByA11yState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n\n getByAccessibilityState: GetByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n getAllByAccessibilityState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByAccessibilityState: QueryByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryAllByAccessibilityState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByAccessibilityState: FindByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findAllByAccessibilityState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n};\n\nexport const bindByA11yStateQueries = (\n instance: ReactTestInstance\n): ByA11yStateQueries => {\n const getByA11yState = getBy(instance);\n const getAllByA11yState = getAllBy(instance);\n const queryByA11yState = queryBy(instance);\n const queryAllByA11yState = queryAllBy(instance);\n const findByA11yState = findBy(instance);\n const findAllByA11yState = findAllBy(instance);\n\n return {\n ...deprecateQueries(\n {\n getByA11yState,\n getAllByA11yState,\n queryByA11yState,\n queryAllByA11yState,\n findByA11yState,\n findAllByA11yState,\n getByAccessibilityState: getByA11yState,\n getAllByAccessibilityState: getAllByA11yState,\n queryByAccessibilityState: queryByA11yState,\n queryAllByAccessibilityState: queryAllByA11yState,\n findByAccessibilityState: findByA11yState,\n findAllByAccessibilityState: findAllByA11yState,\n },\n 'Use {queryPrefix}ByRole(role, { disabled, selected, checked, busy, expanded }) query or expect(...).toHaveAccessibilityState(...) matcher from \"@testing-library/jest-native\" package instead.'\n ),\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAWA,MAAMK,mBAAmB,GACvBC,QAA2B,IAK3B,SAASC,qBAAqBA,CAACC,OAAO,EAAEC,YAAY,EAAE;EACpD,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPK,IAAI,IACH,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAAI,IAAAC,2CAAuB,EAACF,IAAI,EAAEH,OAAO,CAAC,EACzEC,YACF,CAAC;AACH,CAAC;AAEH,MAAMK,iBAAiB,GAAGA,CAACC,KAAgC,GAAG,CAAC,CAAC,KAAK;EACnE,MAAMC,MAAgB,GAAG,EAAE;EAE3BC,oCAAsB,CAACC,OAAO,CAAEC,QAAQ,IAAK;IAC3C,IAAIJ,KAAK,CAACI,QAAQ,CAAC,KAAKC,SAAS,EAAE;MACjCJ,MAAM,CAACK,IAAI,CAAE,GAAEF,QAAS,WAAUJ,KAAK,CAACI,QAAQ,CAAE,EAAC,CAAC;IACtD;EACF,CAAC,CAAC;EAEF,OAAOH,MAAM,CAACM,IAAI,CAAC,IAAI,CAAC;AAC1B,CAAC;AAED,MAAMC,gBAAgB,GAAIR,KAAgC,IACvD,gCAA+BD,iBAAiB,CAACC,KAAK,CAAE,EAAC;AAE5D,MAAMS,eAAe,GAAIT,KAAgC,IACtD,kCAAiCD,iBAAiB,CAACC,KAAK,CAAE,EAAC;AAE9D,MAAM;EAAEU,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7E1B,mBAAmB,EACnBmB,eAAe,EACfD,gBACF,CAAC;AA6CM,MAAMS,sBAAsB,GACjC1B,QAA2B,IACJ;EACvB,MAAM2B,cAAc,GAAGR,KAAK,CAACnB,QAAQ,CAAC;EACtC,MAAM4B,iBAAiB,GAAGR,QAAQ,CAACpB,QAAQ,CAAC;EAC5C,MAAM6B,gBAAgB,GAAGR,OAAO,CAACrB,QAAQ,CAAC;EAC1C,MAAMD,mBAAmB,GAAGuB,UAAU,CAACtB,QAAQ,CAAC;EAChD,MAAM8B,eAAe,GAAGP,MAAM,CAACvB,QAAQ,CAAC;EACxC,MAAM+B,kBAAkB,GAAGP,SAAS,CAACxB,QAAQ,CAAC;EAE9C,OAAO;IACL,GAAG,IAAAgC,6BAAgB,EACjB;MACEL,cAAc;MACdC,iBAAiB;MACjBC,gBAAgB;MAChB9B,mBAAmB;MACnB+B,eAAe;MACfC,kBAAkB;MAClBE,uBAAuB,EAAEN,cAAc;MACvCO,0BAA0B,EAAEN,iBAAiB;MAC7CO,yBAAyB,EAAEN,gBAAgB;MAC3CO,4BAA4B,EAAErC,mBAAmB;MACjDsC,wBAAwB,EAAEP,eAAe;MACzCQ,2BAA2B,EAAEP;IAC/B,CAAC,EACD,gMACF;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAb,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"file":"a11yState.js","names":["_accessiblity","require","_deprecation","_findAll","_accessibilityState","_makeQueries","queryAllByA11yState","instance","queryAllByA11yStateFn","matcher","queryOptions","findAll","node","matchAccessibilityState","buildErrorMessage","state","errors","accessibilityStateKeys","forEach","stateKey","undefined","push","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByA11yStateQueries","getByA11yState","getAllByA11yState","queryByA11yState","findByA11yState","findAllByA11yState","deprecateQueries","getByAccessibilityState","getAllByAccessibilityState","queryByAccessibilityState","queryAllByAccessibilityState","findByAccessibilityState","findAllByAccessibilityState","exports"],"sources":["../../src/queries/a11yState.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\nconst queryAllByA11yState = (\n instance: ReactTestInstance\n): QueryAllByQuery<AccessibilityStateMatcher, CommonQueryOptions> =>\n function queryAllByA11yStateFn(matcher, queryOptions) {\n return findAll(\n instance,\n (node) => matchAccessibilityState(node, matcher),\n queryOptions\n );\n };\n\nconst buildErrorMessage = (state: AccessibilityStateMatcher = {}) => {\n const errors: string[] = [];\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (state[stateKey] !== undefined) {\n errors.push(`${stateKey} state: ${state[stateKey]}`);\n }\n });\n\n return errors.join(', ');\n};\n\nconst getMultipleError = (state: AccessibilityStateMatcher) =>\n `Found multiple elements with ${buildErrorMessage(state)}`;\n\nconst getMissingError = (state: AccessibilityStateMatcher) =>\n `Unable to find an element with ${buildErrorMessage(state)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByA11yState,\n getMissingError,\n getMultipleError\n);\n\nexport type ByA11yStateQueries = {\n getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n getAllByA11yState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByA11yState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryAllByA11yState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByA11yState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findAllByA11yState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n\n getByAccessibilityState: GetByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n getAllByAccessibilityState: GetAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryByAccessibilityState: QueryByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n queryAllByAccessibilityState: QueryAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findByAccessibilityState: FindByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n findAllByAccessibilityState: FindAllByQuery<\n AccessibilityStateMatcher,\n CommonQueryOptions\n >;\n};\n\nexport const bindByA11yStateQueries = (\n instance: ReactTestInstance\n): ByA11yStateQueries => {\n const getByA11yState = getBy(instance);\n const getAllByA11yState = getAllBy(instance);\n const queryByA11yState = queryBy(instance);\n const queryAllByA11yState = queryAllBy(instance);\n const findByA11yState = findBy(instance);\n const findAllByA11yState = findAllBy(instance);\n\n return {\n ...deprecateQueries(\n {\n getByA11yState,\n getAllByA11yState,\n queryByA11yState,\n queryAllByA11yState,\n findByA11yState,\n findAllByA11yState,\n getByAccessibilityState: getByA11yState,\n getAllByAccessibilityState: getAllByA11yState,\n queryByAccessibilityState: queryByA11yState,\n queryAllByAccessibilityState: queryAllByA11yState,\n findByAccessibilityState: findByA11yState,\n findAllByAccessibilityState: findAllByA11yState,\n },\n 'Use {queryPrefix}ByRole(role, { disabled, selected, checked, busy, expanded }) query or expect(...).toHaveAccessibilityState(...) matcher from \"@testing-library/jest-native\" package instead.'\n ),\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAWA,MAAMK,mBA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AM,CAACtB,QAAQ,CAAC;EACxC,MAAM8B,kBAAkB,GAAGP,SAAS,CAACvB,QAAQ,CAAC;EAE9C,OAAO;IACL,GAAG,IAAA+B,6BAAgB,EACjB;MACEL,cAAc;MACdC,iBAAiB;MACjBC,gBAAgB;MAChB7B,mBAAmB;MACnB8B,eAAe;MACfC,kBAAkB;MAClBE,uBAAuB,EAAEN,cAAc;MACvCO,0BAA0B,EAAEN,iBAAiB;MAC7CO,yBAAyB,EAAEN,gBAAgB;MAC3CO,4BAA4B,EAAEpC,mBAAmB;MACjDqC,wBAAwB,EAAEP,eAAe;MACzCQ,2BAA2B,EAAEP;IAC/B,CAAC,EACD,gMACF;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAb,sBAAA,GAAAA,sBAAA"}
@@ -10,7 +10,7 @@ var _findAll = require("../helpers/findAll");
10
10
  var _accessibilityValue = require("../helpers/matchers/accessibilityValue");
11
11
  var _makeQueries = require("./makeQueries");
12
12
  const queryAllByA11yValue = instance => function queryAllByA11yValueFn(value, queryOptions) {
13
- return (0, _findAll.findAll)(instance, node => typeof node.type === 'string' && (0, _accessibilityValue.matchAccessibilityValue)(node, value), queryOptions);
13
+ return (0, _findAll.findAll)(instance, node => (0, _accessibilityValue.matchAccessibilityValue)(node, value), queryOptions);
14
14
  };
15
15
  const formatQueryParams = matcher => {
16
16
  const params = [];
@@ -1 +1 @@
1
- {"version":3,"file":"a11yValue.js","names":["_accessiblity","require","_deprecation","_findAll","_accessibilityValue","_makeQueries","queryAllByA11yValue","instance","queryAllByA11yValueFn","value","queryOptions","findAll","node","type","matchAccessibilityValue","formatQueryParams","matcher","params","accessiblityValueKeys","forEach","valueKey","undefined","push","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByA11yValueQueries","getByA11yValue","getAllByA11yValue","queryByA11yValue","findByA11yValue","findAllByA11yValue","deprecateQueries","getByAccessibilityValue","getAllByAccessibilityValue","queryByAccessibilityValue","queryAllByAccessibilityValue","findByAccessibilityValue","findAllByAccessibilityValue","exports"],"sources":["../../src/queries/a11yValue.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessiblityValueKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/accessibilityValue';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\nconst queryAllByA11yValue = (\n instance: ReactTestInstance\n): ((\n value: AccessibilityValueMatcher,\n queryOptions?: CommonQueryOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByA11yValueFn(value, queryOptions) {\n return findAll(\n instance,\n (node) =>\n typeof node.type === 'string' && matchAccessibilityValue(node, value),\n queryOptions\n );\n };\n\nconst formatQueryParams = (matcher: AccessibilityValueMatcher) => {\n const params: string[] = [];\n\n accessiblityValueKeys.forEach((valueKey) => {\n if (matcher[valueKey] !== undefined) {\n params.push(`${valueKey} value: ${matcher[valueKey]}`);\n }\n });\n\n return params.join(', ');\n};\n\nconst getMultipleError = (matcher: AccessibilityValueMatcher) =>\n `Found multiple elements with ${formatQueryParams(matcher)}`;\n\nconst getMissingError = (matcher: AccessibilityValueMatcher) =>\n `Unable to find an element with ${formatQueryParams(matcher)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByA11yValue,\n getMissingError,\n getMultipleError\n);\n\nexport type ByA11yValueQueries = {\n getByA11yValue: GetByQuery<AccessibilityValueMatcher, CommonQueryOptions>;\n getAllByA11yValue: GetAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n queryByA11yValue: QueryByQuery<AccessibilityValueMatcher, CommonQueryOptions>;\n queryAllByA11yValue: QueryAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n findByA11yValue: FindByQuery<AccessibilityValueMatcher, CommonQueryOptions>;\n findAllByA11yValue: FindAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n\n getByAccessibilityValue: GetByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n getAllByAccessibilityValue: GetAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n queryByAccessibilityValue: QueryByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n queryAllByAccessibilityValue: QueryAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n findByAccessibilityValue: FindByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n findAllByAccessibilityValue: FindAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n};\n\nexport const bindByA11yValueQueries = (\n instance: ReactTestInstance\n): ByA11yValueQueries => {\n const getByA11yValue = getBy(instance);\n const getAllByA11yValue = getAllBy(instance);\n const queryByA11yValue = queryBy(instance);\n const queryAllByA11yValue = queryAllBy(instance);\n const findByA11yValue = findBy(instance);\n const findAllByA11yValue = findAllBy(instance);\n\n return {\n ...deprecateQueries(\n {\n getByA11yValue,\n getAllByA11yValue,\n queryByA11yValue,\n queryAllByA11yValue,\n findByA11yValue,\n findAllByA11yValue,\n getByAccessibilityValue: getByA11yValue,\n getAllByAccessibilityValue: getAllByA11yValue,\n queryByAccessibilityValue: queryByA11yValue,\n queryAllByAccessibilityValue: queryAllByA11yValue,\n findByAccessibilityValue: findByA11yValue,\n findAllByAccessibilityValue: findAllByA11yValue,\n },\n 'Use expect(...).toHaveAccessibilityValue(...) matcher from \"@testing-library/jest-native\" package or {queryPrefix}ByRole(role, { value: ... }) query instead.'\n ),\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAA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GR,OAAO,CAACrB,QAAQ,CAAC;EAC1C,MAAMD,mBAAmB,GAAGuB,UAAU,CAACtB,QAAQ,CAAC;EAChD,MAAM8B,eAAe,GAAGP,MAAM,CAACvB,QAAQ,CAAC;EACxC,MAAM+B,kBAAkB,GAAGP,SAAS,CAACxB,QAAQ,CAAC;EAE9C,OAAO;IACL,GAAG,IAAAgC,6BAAgB,EACjB;MACEL,cAAc;MACdC,iBAAiB;MACjBC,gBAAgB;MAChB9B,mBAAmB;MACnB+B,eAAe;MACfC,kBAAkB;MAClBE,uBAAuB,EAAEN,cAAc;MACvCO,0BAA0B,EAAEN,iBAAiB;MAC7CO,yBAAyB,EAAEN,gBAAgB;MAC3CO,4BAA4B,EAAErC,mBAAmB;MACjDsC,wBAAwB,EAAEP,eAAe;MACzCQ,2BAA2B,EAAEP;IAC/B,CAAC,EACD,+JACF;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAb,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"file":"a11yValue.js","names":["_accessiblity","require","_deprecation","_findAll","_accessibilityValue","_makeQueries","queryAllByA11yValue","instance","queryAllByA11yValueFn","value","queryOptions","findAll","node","matchAccessibilityValue","formatQueryParams","matcher","params","accessiblityValueKeys","forEach","valueKey","undefined","push","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByA11yValueQueries","getByA11yValue","getAllByA11yValue","queryByA11yValue","findByA11yValue","findAllByA11yValue","deprecateQueries","getByAccessibilityValue","getAllByAccessibilityValue","queryByAccessibilityValue","queryAllByAccessibilityValue","findByAccessibilityValue","findAllByAccessibilityValue","exports"],"sources":["../../src/queries/a11yValue.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessiblityValueKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/accessibilityValue';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\nconst queryAllByA11yValue = (\n instance: ReactTestInstance\n): QueryAllByQuery<AccessibilityValueMatcher, CommonQueryOptions> =>\n function queryAllByA11yValueFn(value, queryOptions) {\n return findAll(\n instance,\n (node) => matchAccessibilityValue(node, value),\n queryOptions\n );\n };\n\nconst formatQueryParams = (matcher: AccessibilityValueMatcher) => {\n const params: string[] = [];\n\n accessiblityValueKeys.forEach((valueKey) => {\n if (matcher[valueKey] !== undefined) {\n params.push(`${valueKey} value: ${matcher[valueKey]}`);\n }\n });\n\n return params.join(', ');\n};\n\nconst getMultipleError = (matcher: AccessibilityValueMatcher) =>\n `Found multiple elements with ${formatQueryParams(matcher)}`;\n\nconst getMissingError = (matcher: AccessibilityValueMatcher) =>\n `Unable to find an element with ${formatQueryParams(matcher)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByA11yValue,\n getMissingError,\n getMultipleError\n);\n\nexport type ByA11yValueQueries = {\n getByA11yValue: GetByQuery<AccessibilityValueMatcher, CommonQueryOptions>;\n getAllByA11yValue: GetAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n queryByA11yValue: QueryByQuery<AccessibilityValueMatcher, CommonQueryOptions>;\n queryAllByA11yValue: QueryAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n findByA11yValue: FindByQuery<AccessibilityValueMatcher, CommonQueryOptions>;\n findAllByA11yValue: FindAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n\n getByAccessibilityValue: GetByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n getAllByAccessibilityValue: GetAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n queryByAccessibilityValue: QueryByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n queryAllByAccessibilityValue: QueryAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n findByAccessibilityValue: FindByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n findAllByAccessibilityValue: FindAllByQuery<\n AccessibilityValueMatcher,\n CommonQueryOptions\n >;\n};\n\nexport const bindByA11yValueQueries = (\n instance: ReactTestInstance\n): ByA11yValueQueries => {\n const getByA11yValue = getBy(instance);\n const getAllByA11yValue = getAllBy(instance);\n const queryByA11yValue = queryBy(instance);\n const queryAllByA11yValue = queryAllBy(instance);\n const findByA11yValue = findBy(instance);\n const findAllByA11yValue = findAllBy(instance);\n\n return {\n ...deprecateQueries(\n {\n getByA11yValue,\n getAllByA11yValue,\n queryByA11yValue,\n queryAllByA11yValue,\n findByA11yValue,\n findAllByA11yValue,\n getByAccessibilityValue: getByA11yValue,\n getAllByAccessibilityValue: getAllByA11yValue,\n queryByAccessibilityValue: queryByA11yValue,\n queryAllByAccessibilityValue: queryAllByA11yValue,\n findByAccessibilityValue: findByA11yValue,\n findAllByAccessibilityValue: findAllByA11yValue,\n },\n 'Use expect(...).toHaveAccessibilityValue(...) matcher from \"@testing-library/jest-native\" package or {queryPrefix}ByRole(role, { value: ... }) query instead.'\n ),\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAWA,MAAMK,mBAAmB,GACvBC,QAA2B,IAE3B,SAASC,qBAAqBA,CAACC,KAAK,EAAEC,YAAY,EAAE;EAClD,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPK,IAAI,IAAK,IAAAC,2CAAuB,EAACD,IAAI,EAAEH,KAAK,CAAC,EAC9CC,YACF,CAAC;AACH,CA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B,EAAEN,cAAc;MACvCO,0BAA0B,EAAEN,iBAAiB;MAC7CO,yBAAyB,EAAEN,gBAAgB;MAC3CO,4BAA4B,EAAEpC,mBAAmB;MACjDqC,wBAAwB,EAAEP,eAAe;MACzCQ,2BAA2B,EAAEP;IAC/B,CAAC,EACD,+JACF;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAb,sBAAA,GAAAA,sBAAA"}
@@ -4,21 +4,20 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByDisplayValueQueries = void 0;
7
- var _filterNodeByType = require("../helpers/filterNodeByType");
8
7
  var _findAll = require("../helpers/findAll");
9
- var _matches = require("../matches");
10
8
  var _hostComponentNames = require("../helpers/host-component-names");
9
+ var _matches = require("../matches");
11
10
  var _makeQueries = require("./makeQueries");
12
- const getTextInputNodeByDisplayValue = (node, value, options = {}) => {
11
+ const matchDisplayValue = (node, value, options = {}) => {
13
12
  const {
14
13
  exact,
15
14
  normalizer
16
15
  } = options;
17
- const nodeValue = node.props.value !== undefined ? node.props.value : node.props.defaultValue;
18
- return (0, _filterNodeByType.filterNodeByType)(node, (0, _hostComponentNames.getHostComponentNames)().textInput) && (0, _matches.matches)(value, nodeValue, normalizer, exact);
16
+ const nodeValue = node.props.value ?? node.props.defaultValue;
17
+ return (0, _matches.matches)(value, nodeValue, normalizer, exact);
19
18
  };
20
19
  const queryAllByDisplayValue = instance => function queryAllByDisplayValueFn(displayValue, queryOptions) {
21
- return (0, _findAll.findAll)(instance, node => getTextInputNodeByDisplayValue(node, displayValue, queryOptions), queryOptions);
20
+ return (0, _findAll.findAll)(instance, node => (0, _hostComponentNames.isHostTextInput)(node) && matchDisplayValue(node, displayValue, queryOptions), queryOptions);
22
21
  };
23
22
  const getMultipleError = displayValue => `Found multiple elements with display value: ${String(displayValue)} `;
24
23
  const getMissingError = displayValue => `Unable to find an element with displayValue: ${String(displayValue)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"displayValue.js","names":["_filterNodeByType","require","_findAll","_matches","_hostComponentNames","_makeQueries","getTextInputNodeByDisplayValue","node","value","options","exact","normalizer","nodeValue","props","undefined","defaultValue","filterNodeByType","getHostComponentNames","textInput","matches","queryAllByDisplayValue","instance","queryAllByDisplayValueFn","displayValue","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByDisplayValueQueries","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","findByDisplayValue","findAllByDisplayValue","exports"],"sources":["../../src/queries/displayValue.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { filterNodeByType } from '../helpers/filterNodeByType';\nimport { findAll } from '../helpers/findAll';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { getHostComponentNames } from '../helpers/host-component-names';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;\n\nconst getTextInputNodeByDisplayValue = (\n node: ReactTestInstance,\n value: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n const nodeValue =\n node.props.value !== undefined ? node.props.value : node.props.defaultValue;\n\n return (\n filterNodeByType(node, getHostComponentNames().textInput) &&\n matches(value, nodeValue, normalizer, exact)\n );\n};\n\nconst queryAllByDisplayValue = (\n instance: ReactTestInstance\n): ((\n displayValue: TextMatch,\n queryOptions?: ByDisplayValueOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByDisplayValueFn(displayValue, queryOptions) {\n return findAll(\n instance,\n (node) =>\n getTextInputNodeByDisplayValue(node, displayValue, queryOptions),\n queryOptions\n );\n };\n\nconst getMultipleError = (displayValue: TextMatch) =>\n `Found multiple elements with display value: ${String(displayValue)} `;\nconst getMissingError = (displayValue: TextMatch) =>\n `Unable to find an element with displayValue: ${String(displayValue)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByDisplayValue,\n getMissingError,\n getMultipleError\n);\n\nexport type ByDisplayValueQueries = {\n getByDisplayValue: GetByQuery<TextMatch, ByDisplayValueOptions>;\n getAllByDisplayValue: GetAllByQuery<TextMatch, ByDisplayValueOptions>;\n queryByDisplayValue: QueryByQuery<TextMatch, ByDisplayValueOptions>;\n queryAllByDisplayValue: QueryAllByQuery<TextMatch, ByDisplayValueOptions>;\n findByDisplayValue: FindByQuery<TextMatch, ByDisplayValueOptions>;\n findAllByDisplayValue: FindAllByQuery<TextMatch, ByDisplayValueOptions>;\n};\n\nexport const bindByDisplayValueQueries = (\n instance: ReactTestInstance\n): ByDisplayValueQueries => ({\n getByDisplayValue: getBy(instance),\n getAllByDisplayValue: getAllBy(instance),\n queryByDisplayValue: queryBy(instance),\n queryAllByDisplayValue: queryAllBy(instance),\n findByDisplayValue: findBy(instance),\n findAllByDisplayValue: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAaA,MAAMK,8BAA8B,GAAGA,CACrCC,IAAuB,EACvBC,KAAgB,EAChBC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,MAAMG,SAAS,GACbL,IAAI,CAACM,KAAK,CAACL,KAAK,KAAKM,SAAS,GAAGP,IAAI,CAACM,KAAK,CAACL,KAAK,GAAGD,IAAI,CAACM,KAAK,CAACE,YAAY;EAE7E,OACE,IAAAC,kCAAgB,EAACT,IAAI,EAAE,IAAAU,yCAAqB,EAAC,CAAC,CAACC,SAAS,CAAC,IACzD,IAAAC,gBAAO,EAACX,KAAK,EAAEI,SAAS,EAAED,UAAU,EAAED,KAAK,CAAC;AAEhD,CAAC;AAED,MAAMU,sBAAsB,GAC1BC,QAA2B,IAK3B,SAASC,wBAAwBA,CAACC,YAAY,EAAEC,YAAY,EAAE;EAC5D,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPd,IAAI,IACHD,8BAA8B,CAACC,IAAI,EAAEgB,YAAY,EAAEC,YAAY,CAAC,EAClEA,YACF,CAAC;AACH,CAAC;AAEH,MAAME,gBAAgB,GAAIH,YAAuB,IAC9C,+CAA8CI,MAAM,CAACJ,YAAY,CAAE,GAAE;AACxE,MAAMK,eAAe,GAAIL,YAAuB,IAC7C,gDAA+CI,MAAM,CAACJ,YAAY,CAAE,EAAC;AAExE,MAAM;EAAEM,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7Ef,sBAAsB,EACtBQ,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,yBAAyB,GACpCf,QAA2B,KACA;EAC3BgB,iBAAiB,EAAER,KAAK,CAACR,QAAQ,CAAC;EAClCiB,oBAAoB,EAAER,QAAQ,CAACT,QAAQ,CAAC;EACxCkB,mBAAmB,EAAER,OAAO,CAACV,QAAQ,CAAC;EACtCD,sBAAsB,EAAEY,UAAU,CAACX,QAAQ,CAAC;EAC5CmB,kBAAkB,EAAEP,MAAM,CAACZ,QAAQ,CAAC;EACpCoB,qBAAqB,EAAEP,SAAS,CAACb,QAAQ;AAC3C,CAAC,CAAC;AAACqB,OAAA,CAAAN,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"file":"displayValue.js","names":["_findAll","require","_hostComponentNames","_matches","_makeQueries","matchDisplayValue","node","value","options","exact","normalizer","nodeValue","props","defaultValue","matches","queryAllByDisplayValue","instance","queryAllByDisplayValueFn","displayValue","queryOptions","findAll","isHostTextInput","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByDisplayValueQueries","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","findByDisplayValue","findAllByDisplayValue","exports"],"sources":["../../src/queries/displayValue.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;\n\nconst matchDisplayValue = (\n node: ReactTestInstance,\n value: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n const nodeValue = node.props.value ?? node.props.defaultValue;\n\n return matches(value, nodeValue, normalizer, exact);\n};\n\nconst queryAllByDisplayValue = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByDisplayValueOptions> =>\n function queryAllByDisplayValueFn(displayValue, queryOptions) {\n return findAll(\n instance,\n (node) =>\n isHostTextInput(node) &&\n matchDisplayValue(node, displayValue, queryOptions),\n queryOptions\n );\n };\n\nconst getMultipleError = (displayValue: TextMatch) =>\n `Found multiple elements with display value: ${String(displayValue)} `;\nconst getMissingError = (displayValue: TextMatch) =>\n `Unable to find an element with displayValue: ${String(displayValue)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByDisplayValue,\n getMissingError,\n getMultipleError\n);\n\nexport type ByDisplayValueQueries = {\n getByDisplayValue: GetByQuery<TextMatch, ByDisplayValueOptions>;\n getAllByDisplayValue: GetAllByQuery<TextMatch, ByDisplayValueOptions>;\n queryByDisplayValue: QueryByQuery<TextMatch, ByDisplayValueOptions>;\n queryAllByDisplayValue: QueryAllByQuery<TextMatch, ByDisplayValueOptions>;\n findByDisplayValue: FindByQuery<TextMatch, ByDisplayValueOptions>;\n findAllByDisplayValue: FindAllByQuery<TextMatch, ByDisplayValueOptions>;\n};\n\nexport const bindByDisplayValueQueries = (\n instance: ReactTestInstance\n): ByDisplayValueQueries => ({\n getByDisplayValue: getBy(instance),\n getAllByDisplayValue: getAllBy(instance),\n queryByDisplayValue: queryBy(instance),\n queryAllByDisplayValue: queryAllBy(instance),\n findByDisplayValue: findBy(instance),\n findAllByDisplayValue: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAaA,MAAMI,iBAAiB,GAAGA,CACxBC,IAAuB,EACvBC,KAAgB,EAChBC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,MAAMG,SAAS,GAAGL,IAAI,CAACM,KAAK,CAACL,KAAK,IAAID,IAAI,CAACM,KAAK,CAACC,YAAY;EAE7D,OAAO,IAAAC,gBAAO,EAACP,KAAK,EAAEI,SAAS,EAAED,UAAU,EAAED,KAAK,CAAC;AACrD,CAAC;AAED,MAAMM,sBAAsB,GAC1BC,QAA2B,IAE3B,SAASC,wBAAwBA,CAACC,YAAY,EAAEC,YAAY,EAAE;EAC5D,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPV,IAAI,IACH,IAAAe,mCAAe,EAACf,IAAI,CAAC,IACrBD,iBAAiB,CAACC,IAAI,EAAEY,YAAY,EAAEC,YAAY,CAAC,EACrDA,YACF,CAAC;AACH,CAAC;AAEH,MAAMG,gBAAgB,GAAIJ,YAAuB,IAC9C,+CAA8CK,MAAM,CAACL,YAAY,CAAE,GAAE;AACxE,MAAMM,eAAe,GAAIN,YAAuB,IAC7C,gDAA+CK,MAAM,CAACL,YAAY,CAAE,EAAC;AAExE,MAAM;EAAEO,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EhB,sBAAsB,EACtBS,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,yBAAyB,GACpChB,QAA2B,KACA;EAC3BiB,iBAAiB,EAAER,KAAK,CAACT,QAAQ,CAAC;EAClCkB,oBAAoB,EAAER,QAAQ,CAACV,QAAQ,CAAC;EACxCmB,mBAAmB,EAAER,OAAO,CAACX,QAAQ,CAAC;EACtCD,sBAAsB,EAAEa,UAAU,CAACZ,QAAQ,CAAC;EAC5CoB,kBAAkB,EAAEP,MAAM,CAACb,QAAQ,CAAC;EACpCqB,qBAAqB,EAAEP,SAAS,CAACd,QAAQ;AAC3C,CAAC,CAAC;AAACsB,OAAA,CAAAN,yBAAA,GAAAA,yBAAA"}
@@ -15,7 +15,7 @@ const getNodeByHintText = (node, text, options = {}) => {
15
15
  return (0, _matches.matches)(text, node.props.accessibilityHint, normalizer, exact);
16
16
  };
17
17
  const queryAllByHintText = instance => function queryAllByA11yHintFn(hint, queryOptions) {
18
- return (0, _findAll.findAll)(instance, node => typeof node.type === 'string' && getNodeByHintText(node, hint, queryOptions), queryOptions);
18
+ return (0, _findAll.findAll)(instance, node => getNodeByHintText(node, hint, queryOptions), queryOptions);
19
19
  };
20
20
  const getMultipleError = hint => `Found multiple elements with accessibilityHint: ${String(hint)} `;
21
21
  const getMissingError = hint => `Unable to find an element with accessibilityHint: ${String(hint)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"hintText.js","names":["_findAll","require","_matches","_makeQueries","getNodeByHintText","node","text","options","exact","normalizer","matches","props","accessibilityHint","queryAllByHintText","instance","queryAllByA11yHintFn","hint","queryOptions","findAll","type","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByHintTextQueries","getByHintText","getAllByHintText","queryByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint","exports"],"sources":["../../src/queries/hintText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByHintTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst getNodeByHintText = (\n node: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n return matches(text, node.props.accessibilityHint, normalizer, exact);\n};\n\nconst queryAllByHintText = (\n instance: ReactTestInstance\n): ((\n hint: TextMatch,\n queryOptions?: ByHintTextOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByA11yHintFn(hint, queryOptions) {\n return findAll(\n instance,\n (node) =>\n typeof node.type === 'string' &&\n getNodeByHintText(node, hint, queryOptions),\n queryOptions\n );\n };\n\nconst getMultipleError = (hint: TextMatch) =>\n `Found multiple elements with accessibilityHint: ${String(hint)} `;\nconst getMissingError = (hint: TextMatch) =>\n `Unable to find an element with accessibilityHint: ${String(hint)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByHintText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByHintTextQueries = {\n getByHintText: GetByQuery<TextMatch, ByHintTextOptions>;\n getAllByHintText: GetAllByQuery<TextMatch, ByHintTextOptions>;\n queryByHintText: QueryByQuery<TextMatch, ByHintTextOptions>;\n queryAllByHintText: QueryAllByQuery<TextMatch, ByHintTextOptions>;\n findByHintText: FindByQuery<TextMatch, ByHintTextOptions>;\n findAllByHintText: FindAllByQuery<TextMatch, ByHintTextOptions>;\n\n // a11yHint aliases\n getByA11yHint: GetByQuery<TextMatch, ByHintTextOptions>;\n getAllByA11yHint: GetAllByQuery<TextMatch, ByHintTextOptions>;\n queryByA11yHint: QueryByQuery<TextMatch, ByHintTextOptions>;\n queryAllByA11yHint: QueryAllByQuery<TextMatch, ByHintTextOptions>;\n findByA11yHint: FindByQuery<TextMatch, ByHintTextOptions>;\n findAllByA11yHint: FindAllByQuery<TextMatch, ByHintTextOptions>;\n\n // accessibilityHint aliases\n getByAccessibilityHint: GetByQuery<TextMatch, ByHintTextOptions>;\n getAllByAccessibilityHint: GetAllByQuery<TextMatch, ByHintTextOptions>;\n queryByAccessibilityHint: QueryByQuery<TextMatch, ByHintTextOptions>;\n queryAllByAccessibilityHint: QueryAllByQuery<TextMatch, ByHintTextOptions>;\n findByAccessibilityHint: FindByQuery<TextMatch, ByHintTextOptions>;\n findAllByAccessibilityHint: FindAllByQuery<TextMatch, ByHintTextOptions>;\n};\n\nexport const bindByHintTextQueries = (\n instance: ReactTestInstance\n): ByHintTextQueries => {\n const getByHintText = getBy(instance);\n const getAllByHintText = getAllBy(instance);\n const queryByHintText = queryBy(instance);\n const queryAllByHintText = queryAllBy(instance);\n const findByHintText = findBy(instance);\n const findAllByHintText = findAllBy(instance);\n\n return {\n getByHintText,\n getAllByHintText,\n queryByHintText,\n queryAllByHintText,\n findByHintText,\n findAllByHintText,\n\n // a11yHint aliases\n getByA11yHint: getByHintText,\n getAllByA11yHint: getAllByHintText,\n queryByA11yHint: queryByHintText,\n queryAllByA11yHint: queryAllByHintText,\n findByA11yHint: findByHintText,\n findAllByA11yHint: findAllByHintText,\n\n // accessibilityHint aliases\n getByAccessibilityHint: getByHintText,\n getAllByAccessibilityHint: getAllByHintText,\n queryByAccessibilityHint: queryByHintText,\n queryAllByAccessibilityHint: queryAllByHintText,\n findByAccess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,QAAQ,CAAC;EACzC,MAAMD,kBAAkB,GAAGa,UAAU,CAACZ,QAAQ,CAAC;EAC/C,MAAMoB,cAAc,GAAGP,MAAM,CAACb,QAAQ,CAAC;EACvC,MAAMqB,iBAAiB,GAAGP,SAAS,CAACd,QAAQ,CAAC;EAE7C,OAAO;IACLiB,aAAa;IACbC,gBAAgB;IAChBC,eAAe;IACfpB,kBAAkB;IAClBqB,cAAc;IACdC,iBAAiB;IAEjB;IACAC,aAAa,EAAEL,aAAa;IAC5BM,gBAAgB,EAAEL,gBAAgB;IAClCM,eAAe,EAAEL,eAAe;IAChCM,kBAAkB,EAAE1B,kBAAkB;IACtC2B,cAAc,EAAEN,cAAc;IAC9BO,iBAAiB,EAAEN,iBAAiB;IAEpC;IACAO,sBAAsB,EAAEX,aAAa;IACrCY,yBAAyB,EAAEX,gBAAgB;IAC3CY,wBAAwB,EAAEX,eAAe;IACzCY,2BAA2B,EAAEhC,kBAAkB;IAC/CiC,uBAAuB,EAAEZ,cAAc;IACvCa,0BAA0B,EAAEZ;EAC9B,CAAC;AACH,CAAC;AAACa,OAAA,CAAAlB,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"file":"hintText.js","names":["_findAll","require","_matches","_makeQueries","getNodeByHintText","node","text","options","exact","normalizer","matches","props","accessibilityHint","queryAllByHintText","instance","queryAllByA11yHintFn","hint","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByHintTextQueries","getByHintText","getAllByHintText","queryByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint","exports"],"sources":["../../src/queries/hintText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByHintTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst getNodeByHintText = (\n node: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n return matches(text, node.props.accessibilityHint, normalizer, exact);\n};\n\nconst queryAllByHintText = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByHintTextOptions> =>\n function queryAllByA11yHintFn(hint, queryOptions) {\n return findAll(\n instance,\n (node) => getNodeByHintText(node, hint, queryOptions),\n queryOptions\n );\n };\n\nconst getMultipleError = (hint: TextMatch) =>\n `Found multiple elements with accessibilityHint: ${String(hint)} `;\nconst getMissingError = (hint: TextMatch) =>\n `Unable to find an element with accessibilityHint: ${String(hint)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByHintText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByHintTextQueries = {\n getByHintText: GetByQuery<TextMatch, ByHintTextOptions>;\n getAllByHintText: GetAllByQuery<TextMatch, ByHintTextOptions>;\n queryByHintText: QueryByQuery<TextMatch, ByHintTextOptions>;\n queryAllByHintText: QueryAllByQuery<TextMatch, ByHintTextOptions>;\n findByHintText: FindByQuery<TextMatch, ByHintTextOptions>;\n findAllByHintText: FindAllByQuery<TextMatch, ByHintTextOptions>;\n\n // a11yHint aliases\n getByA11yHint: GetByQuery<TextMatch, ByHintTextOptions>;\n getAllByA11yHint: GetAllByQuery<TextMatch, ByHintTextOptions>;\n queryByA11yHint: QueryByQuery<TextMatch, ByHintTextOptions>;\n queryAllByA11yHint: QueryAllByQuery<TextMatch, ByHintTextOptions>;\n findByA11yHint: FindByQuery<TextMatch, ByHintTextOptions>;\n findAllByA11yHint: FindAllByQuery<TextMatch, ByHintTextOptions>;\n\n // accessibilityHint aliases\n getByAccessibilityHint: GetByQuery<TextMatch, ByHintTextOptions>;\n getAllByAccessibilityHint: GetAllByQuery<TextMatch, ByHintTextOptions>;\n queryByAccessibilityHint: QueryByQuery<TextMatch, ByHintTextOptions>;\n queryAllByAccessibilityHint: QueryAllByQuery<TextMatch, ByHintTextOptions>;\n findByAccessibilityHint: FindByQuery<TextMatch, ByHintTextOptions>;\n findAllByAccessibilityHint: FindAllByQuery<TextMatch, ByHintTextOptions>;\n};\n\nexport const bindByHintTextQueries = (\n instance: ReactTestInstance\n): ByHintTextQueries => {\n const getByHintText = getBy(instance);\n const getAllByHintText = getAllBy(instance);\n const queryByHintText = queryBy(instance);\n const queryAllByHintText = queryAllBy(instance);\n const findByHintText = findBy(instance);\n const findAllByHintText = findAllBy(instance);\n\n return {\n getByHintText,\n getAllByHintText,\n queryByHintText,\n queryAllByHintText,\n findByHintText,\n findAllByHintText,\n\n // a11yHint aliases\n getByA11yHint: getByHintText,\n getAllByA11yHint: getAllByHintText,\n queryByA11yHint: queryByHintText,\n queryAllByA11yHint: queryAllByHintText,\n findByA11yHint: findByHintText,\n findAllByA11yHint: findAllByHintText,\n\n // accessibilityHint aliases\n getByAccessibilityHint: getByHintText,\n getAllByAccessibilityHint: getAllByHintText,\n queryByAccessibilityHint: queryByHintText,\n queryAllByAccessibilityHint: queryAllByHintText,\n findByAccessibilityHint: findByHintText,\n findAllByAccessibilityHint: findAllByHintText,\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAaA,MAAMG,iBAAiB,GAAGA,CACxBC,IAAuB,EACvBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,OAAO,IAAAG,gBAAO,E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AAEzB,kBAAkB;IACtC0B,cAAc,EAAEN,cAAc;IAC9BO,iBAAiB,EAAEN,iBAAiB;IAEpC;IACAO,sBAAsB,EAAEX,aAAa;IACrCY,yBAAyB,EAAEX,gBAAgB;IAC3CY,wBAAwB,EAAEX,eAAe;IACzCY,2BAA2B,EAAE/B,kBAAkB;IAC/CgC,uBAAuB,EAAEZ,cAAc;IACvCa,0BAA0B,EAAEZ;EAC9B,CAAC;AACH,CAAC;AAACa,OAAA,CAAAlB,qBAAA,GAAAA,qBAAA"}
@@ -9,7 +9,7 @@ var _matchLabelText = require("../helpers/matchers/matchLabelText");
9
9
  var _makeQueries = require("./makeQueries");
10
10
  function queryAllByLabelText(instance) {
11
11
  return (text, queryOptions) => {
12
- return (0, _findAll.findAll)(instance, node => typeof node.type === 'string' && (0, _matchLabelText.matchLabelText)(instance, node, text, queryOptions), queryOptions);
12
+ return (0, _findAll.findAll)(instance, node => (0, _matchLabelText.matchLabelText)(instance, node, text, queryOptions), queryOptions);
13
13
  };
14
14
  }
15
15
  const getMultipleError = labelText => `Found multiple elements with accessibilityLabel: ${String(labelText)} `;
@@ -1 +1 @@
1
- {"version":3,"file":"labelText.js","names":["_findAll","require","_matchLabelText","_makeQueries","queryAllByLabelText","instance","text","queryOptions","findAll","node","type","matchLabelText","getMultipleError","labelText","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByLabelTextQueries","getByLabelText","getAllByLabelText","queryByLabelText","findByLabelText","findAllByLabelText","exports"],"sources":["../../src/queries/labelText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { matchLabelText } from '../helpers/matchers/matchLabelText';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;\n\nfunction queryAllByLabelText(instance: ReactTestInstance) {\n return (text: TextMatch, queryOptions?: ByLabelTextOptions) => {\n return findAll(\n instance,\n (node) =>\n typeof node.type === 'string' &&\n matchLabelText(instance, node, text, queryOptions),\n queryOptions\n );\n };\n}\n\nconst getMultipleError = (labelText: TextMatch) =>\n `Found multiple elements with accessibilityLabel: ${String(labelText)} `;\nconst getMissingError = (labelText: TextMatch) =>\n `Unable to find an element with accessibilityLabel: ${String(labelText)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByLabelText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByLabelTextQueries = {\n getByLabelText: GetByQuery<TextMatch, ByLabelTextOptions>;\n getAllByLabelText: GetAllByQuery<TextMatch, ByLabelTextOptions>;\n queryByLabelText: QueryByQuery<TextMatch, ByLabelTextOptions>;\n queryAllByLabelText: QueryAllByQuery<TextMatch, ByLabelTextOptions>;\n findByLabelText: FindByQuery<TextMatch, ByLabelTextOptions>;\n findAllByLabelText: FindAllByQuery<TextMatch, ByLabelTextOptions>;\n};\n\nexport const bindByLabelTextQueries = (\n instance: ReactTestInstance\n): ByLabelTextQueries => ({\n getByLabelText: getBy(instance),\n getAllByLabelText: getAllBy(instance),\n queryByLabelText: queryBy(instance),\n queryAllByLabelText: queryAllBy(instance),\n findByLabelText: findBy(instance),\n findAllByLabelText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAaA,SAASG,mBAAmBA,CAACC,QAA2B,EAAE;EACxD,OAAO,CAACC,IAAe,EAAEC,YAAiC,KAAK;IAC7D,OAAO,IAAAC,gBAAO,EACZH,QAAQ,EACPI,IAAI,IACH,OAAOA,IAAI,CAACC,IAAI,KAAK,QAAQ,IAC7B,IAAAC,8BAAc,EAACN,QAAQ,EAAEI,IAAI,EAAEH,IAAI,EAAEC,YAAY,CAAC,EACpDA,YACF,CAAC;EACH,CAAC;AACH;AAEA,MAAMK,gBAAgB,GAAIC,SAAoB,IAC3C,oDAAmDC,MAAM,CAACD,SAAS,CAAE,GAAE;AAC1E,MAAME,eAAe,GAAIF,SAAoB,IAC1C,sDAAqDC,MAAM,CAACD,SAAS,CAAE,EAAC;AAE3E,MAAM;EAAEG,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7ElB,mBAAmB,EACnBW,eAAe,EACfH,gBACF,CAAC;AAWM,MAAMW,sBAAsB,GACjClB,QAA2B,KACH;EACxBmB,cAAc,EAAER,KAAK,CAACX,QAAQ,CAAC;EAC/BoB,iBAAiB,EAAER,QAAQ,CAACZ,QAAQ,CAAC;EACrCqB,gBAAgB,EAAER,OAAO,CAACb,QAAQ,CAAC;EACnCD,mBAAmB,EAAEe,UAAU,CAACd,QAAQ,CAAC;EACzCsB,eAAe,EAAEP,MAAM,CAACf,QAAQ,CAAC;EACjCuB,kBAAkB,EAAEP,SAAS,CAAChB,QAAQ;AACxC,CAAC,CAAC;AAACwB,OAAA,CAAAN,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"file":"labelText.js","names":["_findAll","require","_matchLabelText","_makeQueries","queryAllByLabelText","instance","text","queryOptions","findAll","node","matchLabelText","getMultipleError","labelText","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByLabelTextQueries","getByLabelText","getAllByLabelText","queryByLabelText","findByLabelText","findAllByLabelText","exports"],"sources":["../../src/queries/labelText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { matchLabelText } from '../helpers/matchers/matchLabelText';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;\n\nfunction queryAllByLabelText(instance: ReactTestInstance) {\n return (text: TextMatch, queryOptions?: ByLabelTextOptions) => {\n return findAll(\n instance,\n (node) => matchLabelText(instance, node, text, queryOptions),\n queryOptions\n );\n };\n}\n\nconst getMultipleError = (labelText: TextMatch) =>\n `Found multiple elements with accessibilityLabel: ${String(labelText)} `;\nconst getMissingError = (labelText: TextMatch) =>\n `Unable to find an element with accessibilityLabel: ${String(labelText)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByLabelText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByLabelTextQueries = {\n getByLabelText: GetByQuery<TextMatch, ByLabelTextOptions>;\n getAllByLabelText: GetAllByQuery<TextMatch, ByLabelTextOptions>;\n queryByLabelText: QueryByQuery<TextMatch, ByLabelTextOptions>;\n queryAllByLabelText: QueryAllByQuery<TextMatch, ByLabelTextOptions>;\n findByLabelText: FindByQuery<TextMatch, ByLabelTextOptions>;\n findAllByLabelText: FindAllByQuery<TextMatch, ByLabelTextOptions>;\n};\n\nexport const bindByLabelTextQueries = (\n instance: ReactTestInstance\n): ByLabelTextQueries => ({\n getByLabelText: getBy(instance),\n getAllByLabelText: getAllBy(instance),\n queryByLabelText: queryBy(instance),\n queryAllByLabelText: queryAllBy(instance),\n findByLabelText: findBy(instance),\n findAllByLabelText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAaA,SAASG,mBAAmBA,CAACC,QAA2B,EAAE;EACxD,OAAO,CAACC,IAAe,EAAEC,YAAiC,KAAK;IAC7D,OAAO,IAAAC,gBAAO,EACZH,QAAQ,EACPI,IAAI,IAAK,IAAAC,8BAAc,EAACL,QAAQ,EAAEI,IAAI,EAAEH,IAAI,EAAEC,YAAY,CAAC,EAC5DA,YACF,CAAC;EACH,CAAC;AACH;AAEA,MAAMI,gBAAgB,GAAIC,SAAoB,IAC3C,oDAAmDC,MAAM,CAACD,SAAS,CAAE,GAAE;AAC1E,MAAME,eAAe,GAAIF,SAAoB,IAC1C,sDAAqDC,MAAM,CAACD,SAAS,CAAE,EAAC;AAE3E,MAAM;EAAEG,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EjB,mBAAmB,EACnBU,eAAe,EACfH,gBACF,CAAC;AAWM,MAAMW,sBAAsB,GACjCjB,QAA2B,KACH;EACxBkB,cAAc,EAAER,KAAK,CAACV,QAAQ,CAAC;EAC/BmB,iBAAiB,EAAER,QAAQ,CAACX,QAAQ,CAAC;EACrCoB,gBAAgB,EAAER,OAAO,CAACZ,QAAQ,CAAC;EACnCD,mBAAmB,EAAEc,UAAU,CAACb,QAAQ,CAAC;EACzCqB,eAAe,EAAEP,MAAM,CAACd,QAAQ,CAAC;EACjCsB,kBAAkB,EAAEP,SAAS,CAACf,QAAQ;AACxC,CAAC,CAAC;AAACuB,OAAA,CAAAN,sBAAA,GAAAA,sBAAA"}
@@ -6,18 +6,17 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.bindByPlaceholderTextQueries = void 0;
7
7
  var _findAll = require("../helpers/findAll");
8
8
  var _matches = require("../matches");
9
- var _filterNodeByType = require("../helpers/filterNodeByType");
10
9
  var _hostComponentNames = require("../helpers/host-component-names");
11
10
  var _makeQueries = require("./makeQueries");
12
- const getTextInputNodeByPlaceholderText = (node, placeholder, options = {}) => {
11
+ const matchPlaceholderText = (node, placeholder, options = {}) => {
13
12
  const {
14
13
  exact,
15
14
  normalizer
16
15
  } = options;
17
- return (0, _filterNodeByType.filterNodeByType)(node, (0, _hostComponentNames.getHostComponentNames)().textInput) && (0, _matches.matches)(placeholder, node.props.placeholder, normalizer, exact);
16
+ return (0, _matches.matches)(placeholder, node.props.placeholder, normalizer, exact);
18
17
  };
19
18
  const queryAllByPlaceholderText = instance => function queryAllByPlaceholderFn(placeholder, queryOptions) {
20
- return (0, _findAll.findAll)(instance, node => getTextInputNodeByPlaceholderText(node, placeholder, queryOptions), queryOptions);
19
+ return (0, _findAll.findAll)(instance, node => (0, _hostComponentNames.isHostTextInput)(node) && matchPlaceholderText(node, placeholder, queryOptions), queryOptions);
21
20
  };
22
21
  const getMultipleError = placeholder => `Found multiple elements with placeholder: ${String(placeholder)} `;
23
22
  const getMissingError = placeholder => `Unable to find an element with placeholder: ${String(placeholder)}`;
@@ -1 +1 @@
1
- {"version":3,"file":"placeholderText.js","names":["_findAll","require","_matches","_filterNodeByType","_hostComponentNames","_makeQueries","getTextInputNodeByPlaceholderText","node","placeholder","options","exact","normalizer","filterNodeByType","getHostComponentNames","textInput","matches","props","queryAllByPlaceholderText","instance","queryAllByPlaceholderFn","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByPlaceholderTextQueries","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText","exports"],"sources":["../../src/queries/placeholderText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { filterNodeByType } from '../helpers/filterNodeByType';\nimport { getHostComponentNames } from '../helpers/host-component-names';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst getTextInputNodeByPlaceholderText = (\n node: ReactTestInstance,\n placeholder: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n\n return (\n filterNodeByType(node, getHostComponentNames().textInput) &&\n matches(placeholder, node.props.placeholder, normalizer, exact)\n );\n};\n\nconst queryAllByPlaceholderText = (\n instance: ReactTestInstance\n): ((\n placeholder: TextMatch,\n queryOptions?: ByPlaceholderTextOptions\n) => Array<ReactTestInstance>) =>\n function queryAllByPlaceholderFn(placeholder, queryOptions) {\n return findAll(\n instance,\n (node) =>\n getTextInputNodeByPlaceholderText(node, placeholder, queryOptions),\n queryOptions\n );\n };\n\nconst getMultipleError = (placeholder: TextMatch) =>\n `Found multiple elements with placeholder: ${String(placeholder)} `;\nconst getMissingError = (placeholder: TextMatch) =>\n `Unable to find an element with placeholder: ${String(placeholder)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByPlaceholderText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByPlaceholderTextQueries = {\n getByPlaceholderText: GetByQuery<TextMatch, ByPlaceholderTextOptions>;\n getAllByPlaceholderText: GetAllByQuery<TextMatch, ByPlaceholderTextOptions>;\n queryByPlaceholderText: QueryByQuery<TextMatch, ByPlaceholderTextOptions>;\n queryAllByPlaceholderText: QueryAllByQuery<\n TextMatch,\n ByPlaceholderTextOptions\n >;\n findByPlaceholderText: FindByQuery<TextMatch, ByPlaceholderTextOptions>;\n findAllByPlaceholderText: FindAllByQuery<TextMatch, ByPlaceholderTextOptions>;\n};\n\nexport const bindByPlaceholderTextQueries = (\n instance: ReactTestInstance\n): ByPlaceholderTextQueries => ({\n getByPlaceholderText: getBy(instance),\n getAllByPlaceholderText: getAllBy(instance),\n queryByPlaceholderText: queryBy(instance),\n queryAllByPlaceholderText: queryAllBy(instance),\n findByPlaceholderText: findBy(instance),\n findAllByPlaceholderText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAA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CAACT,QAAQ,CAAC;EACzCD,yBAAyB,EAAEW,UAAU,CAACV,QAAQ,CAAC;EAC/CkB,qBAAqB,EAAEP,MAAM,CAACX,QAAQ,CAAC;EACvCmB,wBAAwB,EAAEP,SAAS,CAACZ,QAAQ;AAC9C,CAAC,CAAC;AAACoB,OAAA,CAAAN,4BAAA,GAAAA,4BAAA"}
1
+ {"version":3,"file":"placeholderText.js","names":["_findAll","require","_matches","_hostComponentNames","_makeQueries","matchPlaceholderText","node","placeholder","options","exact","normalizer","matches","props","queryAllByPlaceholderText","instance","queryAllByPlaceholderFn","queryOptions","findAll","isHostTextInput","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByPlaceholderTextQueries","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText","exports"],"sources":["../../src/queries/placeholderText.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/findAll';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst matchPlaceholderText = (\n node: ReactTestInstance,\n placeholder: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n return matches(placeholder, node.props.placeholder, normalizer, exact);\n};\n\nconst queryAllByPlaceholderText = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByPlaceholderTextOptions> =>\n function queryAllByPlaceholderFn(placeholder, queryOptions) {\n return findAll(\n instance,\n (node) =>\n isHostTextInput(node) &&\n matchPlaceholderText(node, placeholder, queryOptions),\n queryOptions\n );\n };\n\nconst getMultipleError = (placeholder: TextMatch) =>\n `Found multiple elements with placeholder: ${String(placeholder)} `;\nconst getMissingError = (placeholder: TextMatch) =>\n `Unable to find an element with placeholder: ${String(placeholder)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByPlaceholderText,\n getMissingError,\n getMultipleError\n);\n\nexport type ByPlaceholderTextQueries = {\n getByPlaceholderText: GetByQuery<TextMatch, ByPlaceholderTextOptions>;\n getAllByPlaceholderText: GetAllByQuery<TextMatch, ByPlaceholderTextOptions>;\n queryByPlaceholderText: QueryByQuery<TextMatch, ByPlaceholderTextOptions>;\n queryAllByPlaceholderText: QueryAllByQuery<\n TextMatch,\n ByPlaceholderTextOptions\n >;\n findByPlaceholderText: FindByQuery<TextMatch, ByPlaceholderTextOptions>;\n findAllByPlaceholderText: FindAllByQuery<TextMatch, ByPlaceholderTextOptions>;\n};\n\nexport const bindByPlaceholderTextQueries = (\n instance: ReactTestInstance\n): ByPlaceholderTextQueries => ({\n getByPlaceholderText: getBy(instance),\n getAllByPlaceholderText: getAllBy(instance),\n queryByPlaceholderText: queryBy(instance),\n queryAllByPlaceholderText: queryAllBy(instance),\n findByPlaceholderText: findBy(instance),\n findAllByPlaceholderText: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAaA,MAAMI,oBAAoB,GAAGA,CAC3BC,IAAuB,EACvBC,WAAsB,EACtBC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,OAAO,IAAAG,gBAAO,EAACJ,WAAW,EAAED,IAAI,CAACM,KAAK,CAACL,WAAW,EAAEG,UAAU,EAAED,KAAK,CAAC;AACxE,CAAC;AAED,MAAMI,yBAAyB,GAC7BC,QAA2B,IAE3B,SAASC,uBAAuBA,CAACR,WAAW,EAAES,YAAY,EAAE;EAC1D,OAAO,IAAAC,gBAAO,EACZH,QAAQ,EACPR,IAAI,IACH,IAAAY,mCAAe,EAACZ,IAAI,CAAC,IACrBD,oBAAoB,CAACC,IAAI,EAAEC,WAAW,EAAES,YAAY,CAAC,EACvDA,YACF,CAAC;AACH,CAAC;AAEH,MAAMG,gBAAgB,GAAIZ,WAAsB,IAC7C,6CAA4Ca,MAAM,CAACb,WAAW,CAAE,GAAE;AACrE,MAAMc,eAAe,GAAId,WAAsB,IAC5C,+CAA8Ca,MAAM,CAACb,WAAW,CAAE,EAAC;AAEtE,MAAM;EAAEe,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7Ef,yBAAyB,EACzBQ,eAAe,EACfF,gBACF,CAAC;AAcM,MAAMU,4BAA4B,GACvCf,QAA2B,KACG;EAC9BgB,oBAAoB,EAAER,KAAK,CAACR,QAAQ,CAAC;EACrCiB,uBAAuB,EAAER,QAAQ,CAACT,QAAQ,CAAC;EAC3CkB,sBAAsB,EAAER,OAAO,CAACV,QAAQ,CAAC;EACzCD,yBAAyB,EAAEY,UAAU,CAACX,QAAQ,CAAC;EAC/CmB,qBAAqB,EAAEP,MAAM,CAACZ,QAAQ,CAAC;EACvCoB,wBAAwB,EAAEP,SAAS,CAACb,QAAQ;AAC9C,CAAC,CAAC;AAACqB,OAAA,CAAAN,4BAAA,GAAAA,4BAAA"}
@@ -28,7 +28,7 @@ const matchAccessibilityValueIfNeeded = (node, value) => {
28
28
  const queryAllByRole = instance => function queryAllByRoleFn(role, options) {
29
29
  return (0, _findAll.findAll)(instance, node =>
30
30
  // run the cheapest checks first, and early exit to avoid unneeded computations
31
- typeof node.type === 'string' && (0, _accessiblity.isAccessibilityElement)(node) && (0, _matchStringProp.matchStringProp)(node.props.accessibilityRole, role) && matchAccessibleStateIfNeeded(node, options) && matchAccessibilityValueIfNeeded(node, options?.value) && matchAccessibleNameIfNeeded(node, options?.name), options);
31
+ (0, _accessiblity.isAccessibilityElement)(node) && (0, _matchStringProp.matchStringProp)(node.props.accessibilityRole, role) && matchAccessibleStateIfNeeded(node, options) && matchAccessibilityValueIfNeeded(node, options?.value) && matchAccessibleNameIfNeeded(node, options?.name), options);
32
32
  };
33
33
  const formatQueryParams = (role, options = {}) => {
34
34
  const params = [`role: "${String(role)}"`];
@@ -1 +1 @@
1
- {"version":3,"file":"role.js","names":["_accessiblity","require","_findAll","_accessibilityState","_accessibilityValue","_matchStringProp","_within","_makeQueries","matchAccessibleNameIfNeeded","node","name","queryAllByText","queryAllByLabelText","getQueriesForElement","length","matchAccessibleStateIfNeeded","options","matchAccessibilityState","matchAccessibilityValueIfNeeded","value","matchAccessibilityValue","queryAllByRole","instance","queryAllByRoleFn","role","findAll","type","isAccessibilityElement","matchStringProp","props","accessibilityRole","formatQueryParams","params","String","push","accessibilityStateKeys","forEach","stateKey","undefined","accessiblityValueKeys","valueKey","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByRoleQueries","getByRole","getAllByRole","queryByRole","findByRole","findAllByRole","exports"],"sources":["../../src/queries/role.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport {\n accessibilityStateKeys,\n accessiblityValueKeys,\n isAccessibilityElement,\n} from '../helpers/accessiblity';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/accessibilityValue';\nimport { matchStringProp } from '../helpers/matchers/matchStringProp';\nimport type { TextMatch } from '../matches';\nimport { getQueriesForElement } from '../within';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByRoleOptions = CommonQueryOptions &\n AccessibilityStateMatcher & {\n name?: TextMatch;\n value?: AccessibilityValueMatcher;\n };\n\nconst matchAccessibleNameIfNeeded = (\n node: ReactTestInstance,\n name?: TextMatch\n) => {\n if (name == null) return true;\n\n const { queryAllByText, queryAllByLabelText } = getQueriesForElement(node);\n return (\n queryAllByText(name).length > 0 || queryAllByLabelText(name).length > 0\n );\n};\n\nconst matchAccessibleStateIfNeeded = (\n node: ReactTestInstance,\n options?: ByRoleOptions\n) => {\n return options != null ? matchAccessibilityState(node, options) : true;\n};\n\nconst matchAccessibilityValueIfNeeded = (\n node: ReactTestInstance,\n value?: AccessibilityValueMatcher\n) => {\n return value != null ? matchAccessibilityValue(node, value) : true;\n};\n\nconst queryAllByRole = (\n instance: ReactTestInstance\n): ((role: TextMatch, options?: ByRoleOptions) => Array<ReactTestInstance>) =>\n function queryAllByRoleFn(role, options) {\n return findAll(\n instance,\n (node) =>\n // run the cheapest checks first, and early exit to avoid unneeded computations\n typeof node.type === 'string' &&\n isAccessibilityElement(node) &&\n matchStringProp(node.props.accessibilityRole, role) &&\n matchAccessibleStateIfNeeded(node, options) &&\n matchAccessibilityValueIfNeeded(node, options?.value) &&\n matchAccessibleNameIfNeeded(node, options?.name),\n options\n );\n };\n\nconst formatQueryParams = (role: TextMatch, options: ByRoleOptions = {}) => {\n const params = [`role: \"${String(role)}\"`];\n\n if (options.name) {\n params.push(`name: \"${String(options.name)}\"`);\n }\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (options[stateKey] !== undefined) {\n params.push(`${stateKey} state: ${options[stateKey]}`);\n }\n });\n\n accessiblityValueKeys.forEach((valueKey) => {\n if (options?.value?.[valueKey] !== undefined) {\n params.push(`${valueKey} value: ${options?.value?.[valueKey]}`);\n }\n });\n\n return params.join(', ');\n};\n\nconst getMultipleError = (role: TextMatch, options?: ByRoleOptions) =>\n `Found multiple elements with ${formatQueryParams(role, options)}`;\n\nconst getMissingError = (role: TextMatch, options?: ByRoleOptions) =>\n `Unable to find an element with ${formatQueryParams(role, options)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByRole,\n getMissingError,\n getMultipleError\n);\n\nexport type ByRoleQueries = {\n getByRole: GetByQuery<TextMatch, ByRoleOptions>;\n getAllByRole: GetAllByQuery<TextMatch, ByRoleOptions>;\n queryByRole: QueryByQuery<TextMatch, ByRoleOptions>;\n queryAllByRole: QueryAllByQuery<TextMatch, ByRoleOptions>;\n findByRole: FindByQuery<TextMatch, ByRoleOptions>;\n findAllByRole: FindAllByQuery<TextMatch, ByRoleOptions>;\n};\n\nexport const bindByRoleQueries = (\n instance: ReactTestInstance\n): ByRoleQueries => ({\n getByRole: getBy(instance),\n getAllByRole: getAllBy(instance),\n queryByRole: queryBy(instance),\n queryAllByRole: queryAllBy(instance),\n findByRole: findBy(instance),\n findAllByRole: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAIA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAiBA,MAAMO,2BAA2B,GAAGA,CAClCC,IAAuB,EACvBC,IAAgB,KACb;EACH,IAAIA,IAAI,IAAI,IAAI,EAAE,OAAO,IAAI;EAE7B,MAAM;IAAEC,cAAc;IAAEC;EAAoB,CAAC,GAAG,IAAAC,4BAAoB,EAACJ,IAAI,CAAC;EAC1E,OACEE,cAAc,CAACD,IAAI,CAAC,CAACI,MAAM,GAAG,CAAC,IAAIF,mBAAmB,CAACF,IAAI,CAAC,CAACI,MAAM,GAAG,CAAC;AAE3E,CAAC;AAED,MAAMC,4BAA4B,GAAGA,CACn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essiblity","require","_findAll","_accessibilityState","_accessibilityValue","_matchStringProp","_within","_makeQueries","matchAccessibleNameIfNeeded","node","name","queryAllByText","queryAllByLabelText","getQueriesForElement","length","matchAccessibleStateIfNeeded","options","matchAccessibilityState","matchAccessibilityValueIfNeeded","value","matchAccessibilityValue","queryAllByRole","instance","queryAllByRoleFn","role","findAll","isAccessibilityElement","matchStringProp","props","accessibilityRole","formatQueryParams","params","String","push","accessibilityStateKeys","forEach","stateKey","undefined","accessiblityValueKeys","valueKey","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByRoleQueries","getByRole","getAllByRole","queryByRole","findByRole","findAllByRole","exports"],"sources":["../../src/queries/role.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport {\n accessibilityStateKeys,\n accessiblityValueKeys,\n isAccessibilityElement,\n} from '../helpers/accessiblity';\nimport { findAll } from '../helpers/findAll';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/accessibilityState';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/accessibilityValue';\nimport { matchStringProp } from '../helpers/matchers/matchStringProp';\nimport type { TextMatch } from '../matches';\nimport { getQueriesForElement } from '../within';\nimport { makeQueries } from './makeQueries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './makeQueries';\nimport { CommonQueryOptions } from './options';\n\ntype ByRoleOptions = CommonQueryOptions &\n AccessibilityStateMatcher & {\n name?: TextMatch;\n value?: AccessibilityValueMatcher;\n };\n\nconst matchAccessibleNameIfNeeded = (\n node: ReactTestInstance,\n name?: TextMatch\n) => {\n if (name == null) return true;\n\n const { queryAllByText, queryAllByLabelText } = getQueriesForElement(node);\n return (\n queryAllByText(name).length > 0 || queryAllByLabelText(name).length > 0\n );\n};\n\nconst matchAccessibleStateIfNeeded = (\n node: ReactTestInstance,\n options?: ByRoleOptions\n) => {\n return options != null ? matchAccessibilityState(node, options) : true;\n};\n\nconst matchAccessibilityValueIfNeeded = (\n node: ReactTestInstance,\n value?: AccessibilityValueMatcher\n) => {\n return value != null ? matchAccessibilityValue(node, value) : true;\n};\n\nconst queryAllByRole = (\n instance: ReactTestInstance\n): QueryAllByQuery<TextMatch, ByRoleOptions> =>\n function queryAllByRoleFn(role, options) {\n return findAll(\n instance,\n (node) =>\n // run the cheapest checks first, and early exit to avoid unneeded computations\n isAccessibilityElement(node) &&\n matchStringProp(node.props.accessibilityRole, role) &&\n matchAccessibleStateIfNeeded(node, options) &&\n matchAccessibilityValueIfNeeded(node, options?.value) &&\n matchAccessibleNameIfNeeded(node, options?.name),\n options\n );\n };\n\nconst formatQueryParams = (role: TextMatch, options: ByRoleOptions = {}) => {\n const params = [`role: \"${String(role)}\"`];\n\n if (options.name) {\n params.push(`name: \"${String(options.name)}\"`);\n }\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (options[stateKey] !== undefined) {\n params.push(`${stateKey} state: ${options[stateKey]}`);\n }\n });\n\n accessiblityValueKeys.forEach((valueKey) => {\n if (options?.value?.[valueKey] !== undefined) {\n params.push(`${valueKey} value: ${options?.value?.[valueKey]}`);\n }\n });\n\n return params.join(', ');\n};\n\nconst getMultipleError = (role: TextMatch, options?: ByRoleOptions) =>\n `Found multiple elements with ${formatQueryParams(role, options)}`;\n\nconst getMissingError = (role: TextMatch, options?: ByRoleOptions) =>\n `Unable to find an element with ${formatQueryParams(role, options)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByRole,\n getMissingError,\n getMultipleError\n);\n\nexport type ByRoleQueries = {\n getByRole: GetByQuery<TextMatch, ByRoleOptions>;\n getAllByRole: GetAllByQuery<TextMatch, ByRoleOptions>;\n queryByRole: QueryByQuery<TextMatch, ByRoleOptions>;\n queryAllByRole: QueryAllByQuery<TextMatch, ByRoleOptions>;\n findByRole: FindByQuery<TextMatch, ByRoleOptions>;\n findAllByRole: FindAllByQuery<TextMatch, ByRoleOptions>;\n};\n\nexport const bindByRoleQueries = (\n instance: ReactTestInstance\n): ByRoleQueries => ({\n getByRole: getBy(instance),\n getAllByRole: getAllBy(instance),\n queryByRole: queryBy(instance),\n queryAllByRole: queryAllBy(instance),\n findByRole: findBy(instance),\n findAllByRole: findAllBy(instance),\n});\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAIA,IAAAG,mBAAA,GAAAH,OAAA;AAIA,IAAAI,gBAAA,GAAAJ,OAAA;AAEA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AAiBA,MAAMO,2BAA2B,GAAGA,CAClCC,IAAuB,EACvBC,IAAgB,KACb;EACH,IAAIA,IAAI,IAAI,IAAI,EAAE,OAAO,IAAI;EAE7B,MAAM;IAAEC,cAAc;IAAEC;EAAoB,CAAC,GAAG,IAAAC,4BAAoB,EAACJ,IAAI,CAAC;EAC1E,OACEE,cAAc,CAACD,IAAI,CAAC,CAACI,MAAM,GAAG,CAAC,IAAIF,mBAAmB,CAACF,IAAI,CAAC,CAACI,MAAM,GAAG,CAAC;AAE3E,CAAC;AAED,MAAMC,4BAA4B,GAAGA,CACnCN,IAAuB,EACvBO,OAAuB,KACpB;EACH,OAAOA,OAAO,IAAI,IAAI,GAAG,IAAAC,2CAAuB,EAACR,IAAI,EAAEO,OAAO,CAAC,GAAG,IAAI;AACxE,CAAC;AAED,MAAME,+BAA+B,GAAGA,CACtCT,IAAuB,EACvBU,KAAiC,KAC9B;EACH,OAAOA,KAAK,IAAI,IAAI,GAAG,IAAAC,2CAAuB,EAACX,IAAI,EAAEU,KAAK,CAAC,GAAG,IAAI;AACpE,CAAC;AAED,MAAME,cAAc,GAClBC,QAA2B,IAE3B,SAASC,gBAAgBA,CAACC,IAAI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MC,gBAAgB,GAAGA,CAACjB,IAAe,EAAER,OAAuB,KAC/D,gCAA+Bc,iBAAiB,CAACN,IAAI,EAAER,OAAO,CAAE,EAAC;AAEpE,MAAM0B,eAAe,GAAGA,CAAClB,IAAe,EAAER,OAAuB,KAC9D,kCAAiCc,iBAAiB,CAACN,IAAI,EAAER,OAAO,CAAE,EAAC;AAEtE,MAAM;EAAE2B,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7E5B,cAAc,EACdqB,eAAe,EACfD,gBACF,CAAC;AAWM,MAAMS,iBAAiB,GAC5B5B,QAA2B,KACR;EACnB6B,SAAS,EAAER,KAAK,CAACrB,QAAQ,CAAC;EAC1B8B,YAAY,EAAER,QAAQ,CAACtB,QAAQ,CAAC;EAChC+B,WAAW,EAAER,OAAO,CAACvB,QAAQ,CAAC;EAC9BD,cAAc,EAAEyB,UAAU,CAACxB,QAAQ,CAAC;EACpCgC,UAAU,EAAEP,MAAM,CAACzB,QAAQ,CAAC;EAC5BiC,aAAa,EAAEP,SAAS,CAAC1B,QAAQ;AACnC,CAAC,CAAC;AAACkC,OAAA,CAAAN,iBAAA,GAAAA,iBAAA"}
@@ -7,15 +7,15 @@ exports.bindByTestIdQueries = void 0;
7
7
  var _findAll = require("../helpers/findAll");
8
8
  var _matches = require("../matches");
9
9
  var _makeQueries = require("./makeQueries");
10
- const getNodeByTestId = (node, testID, options = {}) => {
10
+ const matchTestId = (node, testId, options = {}) => {
11
11
  const {
12
12
  exact,
13
13
  normalizer
14
14
  } = options;
15
- return (0, _matches.matches)(testID, node.props.testID, normalizer, exact);
15
+ return (0, _matches.matches)(testId, node.props.testID, normalizer, exact);
16
16
  };
17
17
  const queryAllByTestId = instance => function queryAllByTestIdFn(testId, queryOptions) {
18
- return (0, _findAll.findAll)(instance, node => typeof node.type === 'string' && getNodeByTestId(node, testId, queryOptions), queryOptions);
18
+ return (0, _findAll.findAll)(instance, node => matchTestId(node, testId, queryOptions), queryOptions);
19
19
  };
20
20
  const getMultipleError = testId => `Found multiple elements with testID: ${String(testId)}`;
21
21
  const getMissingError = testId => `Unable to find an element with testID: ${String(testId)}`;