@testing-library/react-native 12.3.0 → 12.3.2

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 (212) hide show
  1. package/build/act.js +1 -2
  2. package/build/act.js.map +1 -1
  3. package/build/config.d.ts +2 -1
  4. package/build/config.js.map +1 -1
  5. package/build/{fireEvent.js → fire-event.js} +2 -3
  6. package/build/fire-event.js.map +1 -0
  7. package/build/helpers/accessiblity.d.ts +4 -0
  8. package/build/helpers/accessiblity.js +35 -6
  9. package/build/helpers/accessiblity.js.map +1 -1
  10. package/build/helpers/{debugDeep.js → debug-deep.js} +1 -1
  11. package/build/helpers/debug-deep.js.map +1 -0
  12. package/build/helpers/{debugShallow.js → debug-shallow.js} +1 -1
  13. package/build/helpers/debug-shallow.js.map +1 -0
  14. package/build/helpers/{findAll.js → find-all.js} +1 -1
  15. package/build/helpers/find-all.js.map +1 -0
  16. package/build/helpers/format-default.js +3 -19
  17. package/build/helpers/format-default.js.map +1 -1
  18. package/build/helpers/format.js +3 -4
  19. package/build/helpers/format.js.map +1 -1
  20. package/build/helpers/host-component-names.d.ts +5 -0
  21. package/build/helpers/host-component-names.js +14 -2
  22. package/build/helpers/host-component-names.js.map +1 -1
  23. package/build/helpers/matchers/{accessibilityState.js → match-accessibility-state.js} +1 -1
  24. package/build/helpers/matchers/match-accessibility-state.js.map +1 -0
  25. package/build/helpers/matchers/{accessibilityValue.js → match-accessibility-value.js} +2 -2
  26. package/build/helpers/matchers/match-accessibility-value.js.map +1 -0
  27. package/build/helpers/matchers/{matchArrayProp.js → match-array-prop.js} +1 -1
  28. package/build/helpers/matchers/match-array-prop.js.map +1 -0
  29. package/build/helpers/matchers/{matchLabelText.js → match-label-text.js} +3 -3
  30. package/build/helpers/matchers/match-label-text.js.map +1 -0
  31. package/build/helpers/matchers/{matchObjectProp.js → match-object-prop.js} +1 -1
  32. package/build/helpers/matchers/match-object-prop.js.map +1 -0
  33. package/build/helpers/matchers/{matchStringProp.js → match-string-prop.js} +1 -1
  34. package/build/helpers/matchers/match-string-prop.js.map +1 -0
  35. package/build/helpers/matchers/{matchTextContent.js → match-text-content.js} +1 -1
  36. package/build/helpers/matchers/match-text-content.js.map +1 -0
  37. package/build/helpers/object.d.ts +2 -0
  38. package/build/helpers/object.js +34 -0
  39. package/build/helpers/object.js.map +1 -0
  40. package/build/helpers/{stringValidation.js → string-validation.js} +1 -1
  41. package/build/helpers/string-validation.js.map +1 -0
  42. package/build/helpers/wrap-async.d.ts +7 -0
  43. package/build/helpers/wrap-async.js +45 -0
  44. package/build/helpers/wrap-async.js.map +1 -0
  45. package/build/matchers/extend-expect.d.js.map +1 -1
  46. package/build/matchers/extend-expect.js +14 -0
  47. package/build/matchers/extend-expect.js.map +1 -1
  48. package/build/matchers/index.d.ts +8 -1
  49. package/build/matchers/index.js +50 -1
  50. package/build/matchers/index.js.map +1 -1
  51. package/build/matchers/to-be-busy.d.ts +6 -0
  52. package/build/matchers/to-be-busy.js +20 -0
  53. package/build/matchers/to-be-busy.js.map +1 -0
  54. package/build/matchers/to-be-collapsed.d.ts +6 -0
  55. package/build/matchers/to-be-collapsed.js +20 -0
  56. package/build/matchers/to-be-collapsed.js.map +1 -0
  57. package/build/matchers/to-be-expanded.d.ts +6 -0
  58. package/build/matchers/to-be-expanded.js +20 -0
  59. package/build/matchers/to-be-expanded.js.map +1 -0
  60. package/build/matchers/to-be-selected.d.ts +6 -0
  61. package/build/matchers/to-be-selected.js +20 -0
  62. package/build/matchers/to-be-selected.js.map +1 -0
  63. package/build/matchers/to-contain-element.d.ts +6 -0
  64. package/build/matchers/to-contain-element.js +26 -0
  65. package/build/matchers/to-contain-element.js.map +1 -0
  66. package/build/matchers/to-have-accessibility-value.d.ts +7 -0
  67. package/build/matchers/to-have-accessibility-value.js +23 -0
  68. package/build/matchers/to-have-accessibility-value.js.map +1 -0
  69. package/build/matchers/to-have-style.d.ts +8 -0
  70. package/build/matchers/to-have-style.js +52 -0
  71. package/build/matchers/to-have-style.js.map +1 -0
  72. package/build/matchers/utils.js +2 -2
  73. package/build/matchers/utils.js.map +1 -1
  74. package/build/pure.d.ts +5 -5
  75. package/build/pure.js +4 -4
  76. package/build/pure.js.map +1 -1
  77. package/build/queries/{a11yState.d.ts → accessibility-state.d.ts} +2 -2
  78. package/build/queries/{a11yState.js → accessibility-state.js} +5 -5
  79. package/build/queries/accessibility-state.js.map +1 -0
  80. package/build/queries/{a11yValue.d.ts → accessibility-value.d.ts} +2 -2
  81. package/build/queries/{a11yValue.js → accessibility-value.js} +5 -5
  82. package/build/queries/accessibility-value.js.map +1 -0
  83. package/build/queries/{displayValue.d.ts → display-value.d.ts} +1 -1
  84. package/build/queries/{displayValue.js → display-value.js} +3 -3
  85. package/build/queries/display-value.js.map +1 -0
  86. package/build/queries/{hintText.d.ts → hint-text.d.ts} +1 -1
  87. package/build/queries/{hintText.js → hint-text.js} +3 -3
  88. package/build/queries/hint-text.js.map +1 -0
  89. package/build/queries/{labelText.d.ts → label-text.d.ts} +1 -1
  90. package/build/queries/{labelText.js → label-text.js} +4 -4
  91. package/build/queries/label-text.js.map +1 -0
  92. package/build/queries/{makeQueries.d.ts → make-queries.d.ts} +1 -1
  93. package/build/queries/{makeQueries.js → make-queries.js} +2 -2
  94. package/build/queries/make-queries.js.map +1 -0
  95. package/build/queries/{placeholderText.d.ts → placeholder-text.d.ts} +1 -1
  96. package/build/queries/{placeholderText.js → placeholder-text.js} +3 -3
  97. package/build/queries/placeholder-text.js.map +1 -0
  98. package/build/queries/role.d.ts +3 -3
  99. package/build/queries/role.js +7 -7
  100. package/build/queries/role.js.map +1 -1
  101. package/build/queries/{testId.d.ts → test-id.d.ts} +1 -1
  102. package/build/queries/{testId.js → test-id.js} +3 -3
  103. package/build/queries/test-id.js.map +1 -0
  104. package/build/queries/text.d.ts +1 -1
  105. package/build/queries/text.js +3 -3
  106. package/build/queries/text.js.map +1 -1
  107. package/build/queries/{unsafeProps.js → unsafe-props.js} +1 -1
  108. package/build/queries/unsafe-props.js.map +1 -0
  109. package/build/queries/{unsafeType.js → unsafe-type.js} +1 -1
  110. package/build/queries/unsafe-type.js.map +1 -0
  111. package/build/react-versions.js +2 -2
  112. package/build/react-versions.js.map +1 -1
  113. package/build/{renderHook.js → render-hook.js} +1 -1
  114. package/build/render-hook.js.map +1 -0
  115. package/build/render.d.ts +169 -169
  116. package/build/render.js +8 -7
  117. package/build/render.js.map +1 -1
  118. package/build/screen.js +1 -2
  119. package/build/screen.js.map +1 -1
  120. package/build/shallow.js +2 -2
  121. package/build/shallow.js.map +1 -1
  122. package/build/test-utils/events.d.ts +1 -2
  123. package/build/test-utils/events.js.map +1 -1
  124. package/build/user-event/event-builder/common.js +1 -2
  125. package/build/user-event/event-builder/common.js.map +1 -1
  126. package/build/user-event/event-builder/index.d.ts +30 -0
  127. package/build/user-event/event-builder/index.js +3 -2
  128. package/build/user-event/event-builder/index.js.map +1 -1
  129. package/build/user-event/event-builder/scroll-view.d.ts +42 -0
  130. package/build/user-event/event-builder/scroll-view.js +52 -0
  131. package/build/user-event/event-builder/scroll-view.js.map +1 -0
  132. package/build/user-event/event-builder/text-input.js +1 -2
  133. package/build/user-event/event-builder/text-input.js.map +1 -1
  134. package/build/user-event/index.d.ts +2 -0
  135. package/build/user-event/index.js +3 -3
  136. package/build/user-event/index.js.map +1 -1
  137. package/build/user-event/press/constants.js +2 -4
  138. package/build/user-event/press/constants.js.map +1 -1
  139. package/build/user-event/press/press.js +9 -13
  140. package/build/user-event/press/press.js.map +1 -1
  141. package/build/user-event/scroll/index.d.ts +1 -0
  142. package/build/user-event/scroll/index.js +19 -0
  143. package/build/user-event/scroll/index.js.map +1 -0
  144. package/build/user-event/scroll/scroll-to.d.ts +16 -0
  145. package/build/user-event/scroll/scroll-to.js +82 -0
  146. package/build/user-event/scroll/scroll-to.js.map +1 -0
  147. package/build/user-event/scroll/state.d.ts +4 -0
  148. package/build/user-event/scroll/state.js +18 -0
  149. package/build/user-event/scroll/state.js.map +1 -0
  150. package/build/user-event/scroll/utils.d.ts +20 -0
  151. package/build/user-event/scroll/utils.js +68 -0
  152. package/build/user-event/scroll/utils.js.map +1 -0
  153. package/build/user-event/setup/setup.d.ts +8 -0
  154. package/build/user-event/setup/setup.js +34 -6
  155. package/build/user-event/setup/setup.js.map +1 -1
  156. package/build/user-event/type/{parseKeys.js → parse-keys.js} +1 -1
  157. package/build/user-event/type/parse-keys.js.map +1 -0
  158. package/build/user-event/type/type.js +1 -1
  159. package/build/user-event/type/type.js.map +1 -1
  160. package/build/{waitForElementToBeRemoved.d.ts → wait-for-element-to-be-removed.d.ts} +1 -1
  161. package/build/{waitForElementToBeRemoved.js → wait-for-element-to-be-removed.js} +2 -2
  162. package/build/wait-for-element-to-be-removed.js.map +1 -0
  163. package/build/{waitFor.js → wait-for.js} +3 -27
  164. package/build/wait-for.js.map +1 -0
  165. package/build/within.d.ts +84 -84
  166. package/build/within.js +12 -13
  167. package/build/within.js.map +1 -1
  168. package/package.json +22 -19
  169. package/pure.d.ts +1 -0
  170. package/build/fireEvent.js.map +0 -1
  171. package/build/helpers/debugDeep.js.map +0 -1
  172. package/build/helpers/debugShallow.js.map +0 -1
  173. package/build/helpers/findAll.js.map +0 -1
  174. package/build/helpers/matchers/accessibilityState.js.map +0 -1
  175. package/build/helpers/matchers/accessibilityValue.js.map +0 -1
  176. package/build/helpers/matchers/matchArrayProp.js.map +0 -1
  177. package/build/helpers/matchers/matchLabelText.js.map +0 -1
  178. package/build/helpers/matchers/matchObjectProp.js.map +0 -1
  179. package/build/helpers/matchers/matchStringProp.js.map +0 -1
  180. package/build/helpers/matchers/matchTextContent.js.map +0 -1
  181. package/build/helpers/stringValidation.js.map +0 -1
  182. package/build/queries/a11yState.js.map +0 -1
  183. package/build/queries/a11yValue.js.map +0 -1
  184. package/build/queries/displayValue.js.map +0 -1
  185. package/build/queries/hintText.js.map +0 -1
  186. package/build/queries/labelText.js.map +0 -1
  187. package/build/queries/makeQueries.js.map +0 -1
  188. package/build/queries/placeholderText.js.map +0 -1
  189. package/build/queries/testId.js.map +0 -1
  190. package/build/queries/unsafeProps.js.map +0 -1
  191. package/build/queries/unsafeType.js.map +0 -1
  192. package/build/renderHook.js.map +0 -1
  193. package/build/user-event/type/parseKeys.js.map +0 -1
  194. package/build/waitFor.js.map +0 -1
  195. package/build/waitForElementToBeRemoved.js.map +0 -1
  196. /package/build/{fireEvent.d.ts → fire-event.d.ts} +0 -0
  197. /package/build/helpers/{debugDeep.d.ts → debug-deep.d.ts} +0 -0
  198. /package/build/helpers/{debugShallow.d.ts → debug-shallow.d.ts} +0 -0
  199. /package/build/helpers/{findAll.d.ts → find-all.d.ts} +0 -0
  200. /package/build/helpers/matchers/{accessibilityState.d.ts → match-accessibility-state.d.ts} +0 -0
  201. /package/build/helpers/matchers/{accessibilityValue.d.ts → match-accessibility-value.d.ts} +0 -0
  202. /package/build/helpers/matchers/{matchArrayProp.d.ts → match-array-prop.d.ts} +0 -0
  203. /package/build/helpers/matchers/{matchLabelText.d.ts → match-label-text.d.ts} +0 -0
  204. /package/build/helpers/matchers/{matchObjectProp.d.ts → match-object-prop.d.ts} +0 -0
  205. /package/build/helpers/matchers/{matchStringProp.d.ts → match-string-prop.d.ts} +0 -0
  206. /package/build/helpers/matchers/{matchTextContent.d.ts → match-text-content.d.ts} +0 -0
  207. /package/build/helpers/{stringValidation.d.ts → string-validation.d.ts} +0 -0
  208. /package/build/queries/{unsafeProps.d.ts → unsafe-props.d.ts} +0 -0
  209. /package/build/queries/{unsafeType.d.ts → unsafe-type.d.ts} +0 -0
  210. /package/build/{renderHook.d.ts → render-hook.d.ts} +0 -0
  211. /package/build/user-event/type/{parseKeys.d.ts → parse-keys.d.ts} +0 -0
  212. /package/build/{waitFor.d.ts → wait-for.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-have-accessibility-value.js","names":["_jestMatcherUtils","require","_accessiblity","_matchAccessibilityValue","_object","_utils","toHaveAccessibilityValue","element","expectedValue","checkHostElement","receivedValue","getAccessibilityValue","pass","matchAccessibilityValue","message","matcher","matcherHint","isNot","stringify","formatMessage","removeUndefinedKeys"],"sources":["../../src/matchers/to-have-accessibility-value.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, stringify } from 'jest-matcher-utils';\nimport { getAccessibilityValue } from '../helpers/accessiblity';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/match-accessibility-value';\nimport { removeUndefinedKeys } from '../helpers/object';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport function toHaveAccessibilityValue(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n expectedValue: AccessibilityValueMatcher\n) {\n checkHostElement(element, toHaveAccessibilityValue, this);\n\n const receivedValue = getAccessibilityValue(element);\n\n return {\n pass: matchAccessibilityValue(element, expectedValue),\n message: () => {\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveAccessibilityValue`,\n 'element',\n stringify(expectedValue)\n );\n return formatMessage(\n matcher,\n `Expected the element ${\n this.isNot ? 'not to' : 'to'\n } have accessibility value`,\n stringify(expectedValue),\n 'Received element with accessibility value',\n stringify(removeUndefinedKeys(receivedValue))\n );\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAIA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,wBAAwBA,CAEtCC,OAA0B,EAC1BC,aAAwC,EACxC;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,wBAAwB,EAAE,IAAI,CAAC;EAEzD,MAAMI,aAAa,GAAG,IAAAC,mCAAqB,EAACJ,OAAO,CAAC;EAEpD,OAAO;IACLK,IAAI,EAAE,IAAAC,gDAAuB,EAACN,OAAO,EAAEC,aAAa,CAAC;IACrDM,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EACxB,GAAE,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAG,2BAA0B,EACtD,SAAS,EACT,IAAAC,2BAAS,EAACV,aAAa,CACzB,CAAC;MACD,OAAO,IAAAW,oBAAa,EAClBJ,OAAO,EACN,wBACC,IAAI,CAACE,KAAK,GAAG,QAAQ,GAAG,IACzB,2BAA0B,EAC3B,IAAAC,2BAAS,EAACV,aAAa,CAAC,EACxB,2CAA2C,EAC3C,IAAAU,2BAAS,EAAC,IAAAE,2BAAmB,EAACV,aAAa,CAAC,CAC9C,CAAC;IACH;EACF,CAAC;AACH"}
@@ -0,0 +1,8 @@
1
+ /// <reference types="jest" />
2
+ import type { ReactTestInstance } from 'react-test-renderer';
3
+ import { ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native';
4
+ export type Style = ViewStyle | TextStyle | ImageStyle;
5
+ export declare function toHaveStyle(this: jest.MatcherContext, element: ReactTestInstance, style: StyleProp<Style>): {
6
+ pass: boolean;
7
+ message: () => string;
8
+ };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.toHaveStyle = toHaveStyle;
7
+ var _reactNative = require("react-native");
8
+ var _jestMatcherUtils = require("jest-matcher-utils");
9
+ var _utils = require("./utils");
10
+ function toHaveStyle(element, style) {
11
+ (0, _utils.checkHostElement)(element, toHaveStyle, this);
12
+ const expected = _reactNative.StyleSheet.flatten(style) ?? {};
13
+ const received = _reactNative.StyleSheet.flatten(element.props.style) ?? {};
14
+ const pass = Object.keys(expected).every(key => this.equals(expected[key], received[key]));
15
+ return {
16
+ pass,
17
+ message: () => {
18
+ const to = this.isNot ? 'not to' : 'to';
19
+ const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toHaveStyle`, 'element', '');
20
+ if (pass) {
21
+ return (0, _utils.formatMessage)(matcher, `Expected element ${to} have style`, formatStyles(expected), 'Received', formatStyles(pickReceivedStyles(expected, received)));
22
+ } else {
23
+ return [matcher, '', expectedDiff(expected, received)].join('\n');
24
+ }
25
+ }
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Generate diff between `expected` and `received` styles.
31
+ */
32
+ function expectedDiff(expected, received) {
33
+ const receivedNarrow = pickReceivedStyles(expected, received);
34
+ return (0, _jestMatcherUtils.diff)(formatStyles(expected), formatStyles(receivedNarrow));
35
+ }
36
+
37
+ /**
38
+ * Pick from `received` style only the keys present in `expected` style.
39
+ */
40
+ function pickReceivedStyles(expected, received) {
41
+ const result = {};
42
+ Object.keys(received).forEach(key => {
43
+ if (expected[key] !== undefined) {
44
+ result[key] = received[key];
45
+ }
46
+ });
47
+ return result;
48
+ }
49
+ function formatStyles(style) {
50
+ return Object.keys(style).sort().map(prop => Array.isArray(style[prop]) ? `${prop}: ${JSON.stringify(style[prop], null, 2)};` : `${prop}: ${style[prop]};`).join('\n');
51
+ }
52
+ //# sourceMappingURL=to-have-style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"to-have-style.js","names":["_reactNative","require","_jestMatcherUtils","_utils","toHaveStyle","element","style","checkHostElement","expected","StyleSheet","flatten","received","props","pass","Object","keys","every","key","equals","message","to","isNot","matcher","matcherHint","formatMessage","formatStyles","pickReceivedStyles","expectedDiff","join","receivedNarrow","diff","result","forEach","undefined","sort","map","prop","Array","isArray","JSON","stringify"],"sources":["../../src/matchers/to-have-style.tsx"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport {\n ImageStyle,\n StyleProp,\n StyleSheet,\n TextStyle,\n ViewStyle,\n} from 'react-native';\nimport { matcherHint, diff } from 'jest-matcher-utils';\nimport { checkHostElement, formatMessage } from './utils';\n\nexport type Style = ViewStyle | TextStyle | ImageStyle;\n\ntype StyleLike = Record<string, unknown>;\n\nexport function toHaveStyle(\n this: jest.MatcherContext,\n element: ReactTestInstance,\n style: StyleProp<Style>\n) {\n checkHostElement(element, toHaveStyle, this);\n\n const expected = (StyleSheet.flatten(style) as StyleLike) ?? {};\n const received = (StyleSheet.flatten(element.props.style) as StyleLike) ?? {};\n\n const pass = Object.keys(expected).every((key) =>\n this.equals(expected[key], received[key])\n );\n\n return {\n pass,\n message: () => {\n const to = this.isNot ? 'not to' : 'to';\n const matcher = matcherHint(\n `${this.isNot ? '.not' : ''}.toHaveStyle`,\n 'element',\n ''\n );\n\n if (pass) {\n return formatMessage(\n matcher,\n `Expected element ${to} have style`,\n formatStyles(expected),\n 'Received',\n formatStyles(pickReceivedStyles(expected, received))\n );\n } else {\n return [matcher, '', expectedDiff(expected, received)].join('\\n');\n }\n },\n };\n}\n\n/**\n * Generate diff between `expected` and `received` styles.\n */\nfunction expectedDiff(expected: StyleLike, received: StyleLike) {\n const receivedNarrow = pickReceivedStyles(expected, received);\n return diff(formatStyles(expected), formatStyles(receivedNarrow));\n}\n\n/**\n * Pick from `received` style only the keys present in `expected` style.\n */\nfunction pickReceivedStyles(expected: StyleLike, received: StyleLike) {\n const result: StyleLike = {};\n Object.keys(received).forEach((key) => {\n if (expected[key] !== undefined) {\n result[key] = received[key];\n }\n });\n\n return result;\n}\n\nfunction formatStyles(style: StyleLike) {\n return Object.keys(style)\n .sort()\n .map((prop) =>\n Array.isArray(style[prop])\n ? `${prop}: ${JSON.stringify(style[prop], null, 2)};`\n : `${prop}: ${style[prop]};`\n )\n .join('\\n');\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,iBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAMO,SAASG,WAAWA,CAEzBC,OAA0B,EAC1BC,KAAuB,EACvB;EACA,IAAAC,uBAAgB,EAACF,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMI,QAAQ,GAAIC,uBAAU,CAACC,OAAO,CAACJ,KAAK,CAAC,IAAkB,CAAC,CAAC;EAC/D,MAAMK,QAAQ,GA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oB,MAAiB,GAAG,CAAC,CAAC;EAC5BjB,MAAM,CAACC,IAAI,CAACJ,QAAQ,CAAC,CAACqB,OAAO,CAAEf,GAAG,IAAK;IACrC,IAAIT,QAAQ,CAACS,GAAG,CAAC,KAAKgB,SAAS,EAAE;MAC/BF,MAAM,CAACd,GAAG,CAAC,GAAGN,QAAQ,CAACM,GAAG,CAAC;IAC7B;EACF,CAAC,CAAC;EAEF,OAAOc,MAAM;AACf;AAEA,SAASN,YAAYA,CAACnB,KAAgB,EAAE;EACtC,OAAOQ,MAAM,CAACC,IAAI,CAACT,KAAK,CAAC,CACtB4B,IAAI,CAAC,CAAC,CACNC,GAAG,CAAEC,IAAI,IACRC,KAAK,CAACC,OAAO,CAAChC,KAAK,CAAC8B,IAAI,CAAC,CAAC,GACrB,GAAEA,IAAK,KAAIG,IAAI,CAACC,SAAS,CAAClC,KAAK,CAAC8B,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAE,GAAE,GAClD,GAAEA,IAAK,KAAI9B,KAAK,CAAC8B,IAAI,CAAE,GAC9B,CAAC,CACAR,IAAI,CAAC,IAAI,CAAC;AACf"}
@@ -13,8 +13,8 @@ var _redent = _interopRequireDefault(require("redent"));
13
13
  var _componentTree = require("../helpers/component-tree");
14
14
  var _formatDefault = require("../helpers/format-default");
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
16
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
17
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  class HostElementTypeError extends Error {
19
19
  constructor(received, matcherFn, context) {
20
20
  super();
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["_jestMatcherUtils","require","_prettyFormat","_interopRequireWildcard","_redent","_interopRequireDefault","_componentTree","_formatDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","HostElementTypeError","Error","constructor","received","matcherFn","context","captureStackTrace","withType","printWithType","printReceived","e","message","matcherHint","isNot","name","RECEIVED_COLOR","join","checkHostElement","element","isHostElement","formatElement","children","props","childrenToDisplay","undefined","redent","prettyFormat","$$typeof","Symbol","for","type","defaultMapProps","plugins","ReactTestComponent","ReactElement","printFunctionName","printBasicPrototype","highlight","formatElementArray","elements","length","map","formatMessage","matcher","expectedLabel","expectedValue","receivedLabel","receivedValue","EXPECTED_COLOR","formatValue","value","stringify"],"sources":["../../src/matchers/utils.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport {\n EXPECTED_COLOR,\n RECEIVED_COLOR,\n matcherHint,\n printWithType,\n printReceived,\n stringify,\n} from 'jest-matcher-utils';\nimport prettyFormat, { plugins } from 'pretty-format';\nimport redent from 'redent';\nimport { isHostElement } from '../helpers/component-tree';\nimport { defaultMapProps } from '../helpers/format-default';\n\nclass HostElementTypeError extends Error {\n constructor(\n received: unknown,\n matcherFn: jest.CustomMatcher,\n context: jest.MatcherContext\n ) {\n super();\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, matcherFn);\n }\n\n let withType = '';\n try {\n withType = printWithType('Received', received, printReceived);\n /* istanbul ignore next */\n } catch (e) {\n // Deliberately empty.\n }\n\n this.message = [\n matcherHint(\n `${context.isNot ? '.not' : ''}.${matcherFn.name}`,\n 'received',\n ''\n ),\n '',\n `${RECEIVED_COLOR('received')} value must be a host element.`,\n withType,\n ].join('\\n');\n }\n}\n\n/**\n * Throws HostElementTypeError if passed element is not a host element.\n *\n * @param element ReactTestInstance to check.\n * @param matcherFn Matcher function calling the check used for formatting error.\n * @param context Jest matcher context used for formatting error.\n */\nexport function checkHostElement(\n element: ReactTestInstance | null | undefined,\n matcherFn: jest.CustomMatcher,\n context: jest.MatcherContext\n): asserts element is ReactTestInstance {\n if (!isHostElement(element)) {\n throw new HostElementTypeError(element, matcherFn, context);\n }\n}\n\n/***\n * Format given element as a pretty-printed string.\n *\n * @param element Element to format.\n */\nexport function formatElement(element: ReactTestInstance | null) {\n if (element == null) {\n return ' null';\n }\n\n const { children, ...props } = element.props;\n const childrenToDisplay =\n typeof children === 'string' ? [children] : undefined;\n\n return redent(\n prettyFormat(\n {\n // This prop is needed persuade the prettyFormat that the element is\n // a ReactTestRendererJSON instance, so it is formatted as JSX.\n $$typeof: Symbol.for('react.test.json'),\n type: element.type,\n props: defaultMapProps(props),\n children: childrenToDisplay,\n },\n {\n plugins: [plugins.ReactTestComponent, plugins.ReactElement],\n printFunctionName: false,\n printBasicPrototype: false,\n highlight: true,\n }\n ),\n 2\n );\n}\n\nexport function formatElementArray(elements: ReactTestInstance[]) {\n if (elements.length === 0) {\n return ' (no elements)';\n }\n\n return redent(elements.map(formatElement).join('\\n'), 2);\n}\n\nexport function formatMessage(\n matcher: string,\n expectedLabel: string,\n expectedValue: string | RegExp,\n receivedLabel: string,\n receivedValue: string | null | undefined\n) {\n return [\n `${matcher}\\n`,\n `${expectedLabel}:\\n${EXPECTED_COLOR(\n redent(formatValue(expectedValue), 2)\n )}`,\n `${receivedLabel}:\\n${RECEIVED_COLOR(\n redent(formatValue(receivedValue), 2)\n )}`,\n ].join('\\n');\n}\n\nfunction formatValue(value: unknown) {\n return typeof value === 'string' ? value : stringify(value);\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAQA,IAAAC,aAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAA4D,SAAAI,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,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,SAAAT,wBAAAK,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAA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AAC;AACH;AAEO,SAASC,kBAAkBA,CAACC,QAA6B,EAAE;EAChE,IAAIA,QAAQ,CAACC,MAAM,KAAK,CAAC,EAAE;IACzB,OAAO,iBAAiB;EAC1B;EAEA,OAAO,IAAAf,eAAM,EAACc,QAAQ,CAACE,GAAG,CAACrB,aAAa,CAAC,CAACJ,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1D;AAEO,SAAS0B,aAAaA,CAC3BC,OAAe,EACfC,aAAqB,EACrBC,aAA8B,EAC9BC,aAAqB,EACrBC,aAAwC,EACxC;EACA,OAAO,CACJ,GAAEJ,OAAQ,IAAG,EACb,GAAEC,aAAc,MAAK,IAAAI,gCAAc,EAClC,IAAAvB,eAAM,EAACwB,WAAW,CAACJ,aAAa,CAAC,EAAE,CAAC,CACtC,CAAE,EAAC,EACF,GAAEC,aAAc,MAAK,IAAA/B,gCAAc,EAClC,IAAAU,eAAM,EAACwB,WAAW,CAACF,aAAa,CAAC,EAAE,CAAC,CACtC,CAAE,EAAC,CACJ,CAAC/B,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAASiC,WAAWA,CAACC,KAAc,EAAE;EACnC,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,IAAAC,2BAAS,EAACD,KAAK,CAAC;AAC7D"}
1
+ {"version":3,"file":"utils.js","names":["_jestMatcherUtils","require","_prettyFormat","_interopRequireWildcard","_redent","_interopRequireDefault","_componentTree","_formatDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","HostElementTypeError","Error","constructor","received","matcherFn","context","captureStackTrace","withType","printWithType","printReceived","message","matcherHint","isNot","name","RECEIVED_COLOR","join","checkHostElement","element","isHostElement","formatElement","children","props","childrenToDisplay","undefined","redent","prettyFormat","$$typeof","Symbol","for","type","defaultMapProps","plugins","ReactTestComponent","ReactElement","printFunctionName","printBasicPrototype","highlight","formatElementArray","elements","length","map","formatMessage","matcher","expectedLabel","expectedValue","receivedLabel","receivedValue","EXPECTED_COLOR","formatValue","value","stringify"],"sources":["../../src/matchers/utils.tsx"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport {\n EXPECTED_COLOR,\n RECEIVED_COLOR,\n matcherHint,\n printWithType,\n printReceived,\n stringify,\n} from 'jest-matcher-utils';\nimport prettyFormat, { plugins } from 'pretty-format';\nimport redent from 'redent';\nimport { isHostElement } from '../helpers/component-tree';\nimport { defaultMapProps } from '../helpers/format-default';\n\nclass HostElementTypeError extends Error {\n constructor(\n received: unknown,\n matcherFn: jest.CustomMatcher,\n context: jest.MatcherContext\n ) {\n super();\n\n /* istanbul ignore next */\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, matcherFn);\n }\n\n let withType = '';\n try {\n withType = printWithType('Received', received, printReceived);\n /* istanbul ignore next */\n } catch (e) {\n // Deliberately empty.\n }\n\n this.message = [\n matcherHint(\n `${context.isNot ? '.not' : ''}.${matcherFn.name}`,\n 'received',\n ''\n ),\n '',\n `${RECEIVED_COLOR('received')} value must be a host element.`,\n withType,\n ].join('\\n');\n }\n}\n\n/**\n * Throws HostElementTypeError if passed element is not a host element.\n *\n * @param element ReactTestInstance to check.\n * @param matcherFn Matcher function calling the check used for formatting error.\n * @param context Jest matcher context used for formatting error.\n */\nexport function checkHostElement(\n element: ReactTestInstance | null | undefined,\n matcherFn: jest.CustomMatcher,\n context: jest.MatcherContext\n): asserts element is ReactTestInstance {\n if (!isHostElement(element)) {\n throw new HostElementTypeError(element, matcherFn, context);\n }\n}\n\n/***\n * Format given element as a pretty-printed string.\n *\n * @param element Element to format.\n */\nexport function formatElement(element: ReactTestInstance | null) {\n if (element == null) {\n return ' null';\n }\n\n const { children, ...props } = element.props;\n const childrenToDisplay =\n typeof children === 'string' ? [children] : undefined;\n\n return redent(\n prettyFormat(\n {\n // This prop is needed persuade the prettyFormat that the element is\n // a ReactTestRendererJSON instance, so it is formatted as JSX.\n $$typeof: Symbol.for('react.test.json'),\n type: element.type,\n props: defaultMapProps(props),\n children: childrenToDisplay,\n },\n {\n plugins: [plugins.ReactTestComponent, plugins.ReactElement],\n printFunctionName: false,\n printBasicPrototype: false,\n highlight: true,\n }\n ),\n 2\n );\n}\n\nexport function formatElementArray(elements: ReactTestInstance[]) {\n if (elements.length === 0) {\n return ' (no elements)';\n }\n\n return redent(elements.map(formatElement).join('\\n'), 2);\n}\n\nexport function formatMessage(\n matcher: string,\n expectedLabel: string,\n expectedValue: string | RegExp,\n receivedLabel: string,\n receivedValue: string | null | undefined\n) {\n return [\n `${matcher}\\n`,\n `${expectedLabel}:\\n${EXPECTED_COLOR(\n redent(formatValue(expectedValue), 2)\n )}`,\n `${receivedLabel}:\\n${RECEIVED_COLOR(\n redent(formatValue(receivedValue), 2)\n )}`,\n ].join('\\n');\n}\n\nfunction formatValue(value: unknown) {\n return typeof value === 'string' ? value : stringify(value);\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAQA,IAAAC,aAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AAA4D,SAAAI,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAT,wBAAAS,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAH,UAAA,SAAAG,CAAA,eAAAA,CAAA,uBA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b,CACF,CAAC,EACD,CACF,CAAC;AACH;AAEO,SAASC,kBAAkBA,CAACC,QAA6B,EAAE;EAChE,IAAIA,QAAQ,CAACC,MAAM,KAAK,CAAC,EAAE;IACzB,OAAO,iBAAiB;EAC1B;EAEA,OAAO,IAAAf,eAAM,EAACc,QAAQ,CAACE,GAAG,CAACrB,aAAa,CAAC,CAACJ,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC1D;AAEO,SAAS0B,aAAaA,CAC3BC,OAAe,EACfC,aAAqB,EACrBC,aAA8B,EAC9BC,aAAqB,EACrBC,aAAwC,EACxC;EACA,OAAO,CACJ,GAAEJ,OAAQ,IAAG,EACb,GAAEC,aAAc,MAAK,IAAAI,gCAAc,EAClC,IAAAvB,eAAM,EAACwB,WAAW,CAACJ,aAAa,CAAC,EAAE,CAAC,CACtC,CAAE,EAAC,EACF,GAAEC,aAAc,MAAK,IAAA/B,gCAAc,EAClC,IAAAU,eAAM,EAACwB,WAAW,CAACF,aAAa,CAAC,EAAE,CAAC,CACtC,CAAE,EAAC,CACJ,CAAC/B,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAASiC,WAAWA,CAACC,KAAc,EAAE;EACnC,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGA,KAAK,GAAG,IAAAC,2BAAS,EAACD,KAAK,CAAC;AAC7D"}
package/build/pure.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  export { default as act } from './act';
2
2
  export { default as cleanup } from './cleanup';
3
- export { default as fireEvent } from './fireEvent';
3
+ export { default as fireEvent } from './fire-event';
4
4
  export { default as render } from './render';
5
- export { default as waitFor } from './waitFor';
6
- export { default as waitForElementToBeRemoved } from './waitForElementToBeRemoved';
5
+ export { default as waitFor } from './wait-for';
6
+ export { default as waitForElementToBeRemoved } from './wait-for-element-to-be-removed';
7
7
  export { within, getQueriesForElement } from './within';
8
8
  export { configure, resetToDefaults } from './config';
9
9
  export { isHiddenFromAccessibility, isInaccessible, } from './helpers/accessiblity';
10
10
  export { getDefaultNormalizer } from './matches';
11
- export { renderHook } from './renderHook';
11
+ export { renderHook } from './render-hook';
12
12
  export { screen } from './screen';
13
13
  export { userEvent } from './user-event';
14
14
  export type { RenderOptions, RenderResult, RenderResult as RenderAPI, DebugFunction, } from './render';
15
- export type { RenderHookOptions, RenderHookResult } from './renderHook';
15
+ export type { RenderHookOptions, RenderHookResult } from './render-hook';
16
16
  export type { Config } from './config';
17
17
  export type { UserEventConfig } from './user-event';
package/build/pure.js CHANGED
@@ -101,15 +101,15 @@ Object.defineProperty(exports, "within", {
101
101
  });
102
102
  var _act = _interopRequireDefault(require("./act"));
103
103
  var _cleanup = _interopRequireDefault(require("./cleanup"));
104
- var _fireEvent = _interopRequireDefault(require("./fireEvent"));
104
+ var _fireEvent = _interopRequireDefault(require("./fire-event"));
105
105
  var _render = _interopRequireDefault(require("./render"));
106
- var _waitFor = _interopRequireDefault(require("./waitFor"));
107
- var _waitForElementToBeRemoved = _interopRequireDefault(require("./waitForElementToBeRemoved"));
106
+ var _waitFor = _interopRequireDefault(require("./wait-for"));
107
+ var _waitForElementToBeRemoved = _interopRequireDefault(require("./wait-for-element-to-be-removed"));
108
108
  var _within = require("./within");
109
109
  var _config = require("./config");
110
110
  var _accessiblity = require("./helpers/accessiblity");
111
111
  var _matches = require("./matches");
112
- var _renderHook = require("./renderHook");
112
+ var _renderHook = require("./render-hook");
113
113
  var _screen = require("./screen");
114
114
  var _userEvent = require("./user-event");
115
115
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/build/pure.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pure.js","names":["_act","_interopRequireDefault","require","_cleanup","_fireEvent","_render","_waitFor","_waitForElementToBeRemoved","_within","_config","_accessiblity","_matches","_renderHook","_screen","_userEvent","obj","__esModule","default"],"sources":["../src/pure.ts"],"sourcesContent":["export { default as act } from './act';\nexport { default as cleanup } from './cleanup';\nexport { default as fireEvent } from './fireEvent';\nexport { default as render } from './render';\nexport { default as waitFor } from './waitFor';\nexport { default as waitForElementToBeRemoved } from './waitForElementToBeRemoved';\nexport { within, getQueriesForElement } from './within';\n\nexport { configure, resetToDefaults } from './config';\nexport {\n isHiddenFromAccessibility,\n isInaccessible,\n} from './helpers/accessiblity';\nexport { getDefaultNormalizer } from './matches';\nexport { renderHook } from './renderHook';\nexport { screen } from './screen';\nexport { userEvent } from './user-event';\n\nexport type {\n RenderOptions,\n RenderResult,\n RenderResult as RenderAPI,\n DebugFunction,\n} from './render';\nexport type { RenderHookOptions, RenderHookResult } from './renderHook';\nexport type { Config } from './config';\nexport type { UserEventConfig } from './user-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,0BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AAIA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AAAyC,SAAAD,uBAAAc,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
1
+ {"version":3,"file":"pure.js","names":["_act","_interopRequireDefault","require","_cleanup","_fireEvent","_render","_waitFor","_waitForElementToBeRemoved","_within","_config","_accessiblity","_matches","_renderHook","_screen","_userEvent","obj","__esModule","default"],"sources":["../src/pure.ts"],"sourcesContent":["export { default as act } from './act';\nexport { default as cleanup } from './cleanup';\nexport { default as fireEvent } from './fire-event';\nexport { default as render } from './render';\nexport { default as waitFor } from './wait-for';\nexport { default as waitForElementToBeRemoved } from './wait-for-element-to-be-removed';\nexport { within, getQueriesForElement } from './within';\n\nexport { configure, resetToDefaults } from './config';\nexport {\n isHiddenFromAccessibility,\n isInaccessible,\n} from './helpers/accessiblity';\nexport { getDefaultNormalizer } from './matches';\nexport { renderHook } from './render-hook';\nexport { screen } from './screen';\nexport { userEvent } from './user-event';\n\nexport type {\n RenderOptions,\n RenderResult,\n RenderResult as RenderAPI,\n DebugFunction,\n} from './render';\nexport type { RenderHookOptions, RenderHookResult } from './render-hook';\nexport type { Config } from './config';\nexport type { UserEventConfig } from './user-event';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,IAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,0BAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAEA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AAIA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AAAyC,SAAAD,uBAAAc,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
- import { AccessibilityStateMatcher } from '../helpers/matchers/accessibilityState';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
2
+ import { AccessibilityStateMatcher } from '../helpers/matchers/match-accessibility-state';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import { CommonQueryOptions } from './options';
5
5
  export type ByA11yStateQueries = {
6
6
  getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.bindByA11yStateQueries = void 0;
7
7
  var _accessiblity = require("../helpers/accessiblity");
8
8
  var _deprecation = require("../helpers/deprecation");
9
- var _findAll = require("../helpers/findAll");
10
- var _accessibilityState = require("../helpers/matchers/accessibilityState");
11
- var _makeQueries = require("./makeQueries");
9
+ var _findAll = require("../helpers/find-all");
10
+ var _matchAccessibilityState = require("../helpers/matchers/match-accessibility-state");
11
+ var _makeQueries = require("./make-queries");
12
12
  const queryAllByA11yState = instance => function queryAllByA11yStateFn(matcher, queryOptions) {
13
- return (0, _findAll.findAll)(instance, node => (0, _accessibilityState.matchAccessibilityState)(node, matcher), queryOptions);
13
+ return (0, _findAll.findAll)(instance, node => (0, _matchAccessibilityState.matchAccessibilityState)(node, matcher), queryOptions);
14
14
  };
15
15
  const buildErrorMessage = (state = {}) => {
16
16
  const errors = [];
@@ -56,4 +56,4 @@ const bindByA11yStateQueries = instance => {
56
56
  };
57
57
  };
58
58
  exports.bindByA11yStateQueries = bindByA11yStateQueries;
59
- //# sourceMappingURL=a11yState.js.map
59
+ //# sourceMappingURL=accessibility-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessibility-state.js","names":["_accessiblity","require","_deprecation","_findAll","_matchAccessibilityState","_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/accessibility-state.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/find-all';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/match-accessibility-state';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\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,wBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAWA,MAAMK,mBAAmB,GACvBC,QAA2B,IAE3B,SAASC,qBAAqBA,CAACC,OAAO,EAAEC,YAAY,EAAE;EACpD,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPK,IAAI,IAAK,IAAAC,gDAAuB,EAACD,IAAI,EAAEH,OAAO,CAAC,EAChDC,YACF,CAAC;AACH,CAAC;AAEH,MAAMI,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,EAC7EzB,mBAAmB,EACnBkB,eAAe,EACfD,gBACF,CAAC;AA6CM,MAAMS,sBAAsB,GACjCzB,QAA2B,IACJ;EACvB,MAAM0B,cAAc,GAAGR,KAAK,CAAClB,QAAQ,CAAC;EACtC,MAAM2B,iBAAiB,GAAGR,QAAQ,CAACnB,QAAQ,CAAC;EAC5C,MAAM4B,gBAAgB,GAAGR,OAAO,CAACpB,QAAQ,CAAC;EAC1C,MAAMD,mBAAmB,GAAGsB,UAAU,CAACrB,QAAQ,CAAC;EAChD,MAAM6B,eAAe,GAAGP,MAAM,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"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
- import { AccessibilityValueMatcher } from '../helpers/matchers/accessibilityValue';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
2
+ import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import { CommonQueryOptions } from './options';
5
5
  export type ByA11yValueQueries = {
6
6
  getByA11yValue: GetByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.bindByA11yValueQueries = void 0;
7
7
  var _accessiblity = require("../helpers/accessiblity");
8
8
  var _deprecation = require("../helpers/deprecation");
9
- var _findAll = require("../helpers/findAll");
10
- var _accessibilityValue = require("../helpers/matchers/accessibilityValue");
11
- var _makeQueries = require("./makeQueries");
9
+ var _findAll = require("../helpers/find-all");
10
+ var _matchAccessibilityValue = require("../helpers/matchers/match-accessibility-value");
11
+ var _makeQueries = require("./make-queries");
12
12
  const queryAllByA11yValue = instance => function queryAllByA11yValueFn(value, queryOptions) {
13
- return (0, _findAll.findAll)(instance, node => (0, _accessibilityValue.matchAccessibilityValue)(node, value), queryOptions);
13
+ return (0, _findAll.findAll)(instance, node => (0, _matchAccessibilityValue.matchAccessibilityValue)(node, value), queryOptions);
14
14
  };
15
15
  const formatQueryParams = matcher => {
16
16
  const params = [];
@@ -56,4 +56,4 @@ const bindByA11yValueQueries = instance => {
56
56
  };
57
57
  };
58
58
  exports.bindByA11yValueQueries = bindByA11yValueQueries;
59
- //# sourceMappingURL=a11yValue.js.map
59
+ //# sourceMappingURL=accessibility-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accessibility-value.js","names":["_accessiblity","require","_deprecation","_findAll","_matchAccessibilityValue","_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/accessibility-value.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessiblityValueKeys } from '../helpers/accessiblity';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/find-all';\nimport {\n AccessibilityValueMatcher,\n matchAccessibilityValue,\n} from '../helpers/matchers/match-accessibility-value';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\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,wBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAWA,MAAMK,mBAAmB,GACvBC,QAA2B,IAE3B,SAASC,qBAAq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AACvB,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,+JACF;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAb,sBAAA,GAAAA,sBAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import type { CommonQueryOptions } from './options';
5
5
  type ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;
6
6
  export type ByDisplayValueQueries = {
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByDisplayValueQueries = void 0;
7
- var _findAll = require("../helpers/findAll");
7
+ var _findAll = require("../helpers/find-all");
8
8
  var _hostComponentNames = require("../helpers/host-component-names");
9
9
  var _textInput = require("../helpers/text-input");
10
10
  var _matches = require("../matches");
11
- var _makeQueries = require("./makeQueries");
11
+ var _makeQueries = require("./make-queries");
12
12
  const matchDisplayValue = (node, expectedValue, options = {}) => {
13
13
  const {
14
14
  exact,
@@ -39,4 +39,4 @@ const bindByDisplayValueQueries = instance => ({
39
39
  findAllByDisplayValue: findAllBy(instance)
40
40
  });
41
41
  exports.bindByDisplayValueQueries = bindByDisplayValueQueries;
42
- //# sourceMappingURL=displayValue.js.map
42
+ //# sourceMappingURL=display-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-value.js","names":["_findAll","require","_hostComponentNames","_textInput","_matches","_makeQueries","matchDisplayValue","node","expectedValue","options","exact","normalizer","nodeValue","getTextInputValue","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/display-value.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/find-all';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { getTextInputValue } from '../helpers/text-input';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;\n\nconst matchDisplayValue = (\n node: ReactTestInstance,\n expectedValue: TextMatch,\n options: TextMatchOptions = {}\n) => {\n const { exact, normalizer } = options;\n const nodeValue = getTextInputValue(node);\n return matches(expectedValue, 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,UAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAaA,MAAMK,iBAAiB,GAAGA,CACxBC,IAAuB,EACvBC,aAAwB,EACxBC,OAAyB,GAAG,CAAC,CAAC,KAC3B;EACH,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,MAAMG,SAAS,GAAG,IAAAC,4BAAiB,EAACN,IAAI,CAAC;EACzC,OAAO,IAAAO,gBAAO,EAACN,aAAa,EAAEI,SAAS,EAAED,UAAU,EAAED,KAAK,CAAC;AAC7D,CAAC;AAED,MAAMK,sBAAsB,GAC1BC,QAA2B,IAE3B,SAASC,wBAAwBA,CAACC,YAAY,EAAEC,YAAY,EAAE;EAC5D,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPT,IAAI,IACH,IAAAc,mCAAe,EAACd,IAAI,CAAC,IACrBD,iBAAiB,CAACC,IAAI,EAAEW,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"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import { CommonQueryOptions } from './options';
5
5
  type ByHintTextOptions = CommonQueryOptions & TextMatchOptions;
6
6
  export type ByHintTextQueries = {
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByHintTextQueries = void 0;
7
- var _findAll = require("../helpers/findAll");
7
+ var _findAll = require("../helpers/find-all");
8
8
  var _matches = require("../matches");
9
- var _makeQueries = require("./makeQueries");
9
+ var _makeQueries = require("./make-queries");
10
10
  const getNodeByHintText = (node, text, options = {}) => {
11
11
  const {
12
12
  exact,
@@ -58,4 +58,4 @@ const bindByHintTextQueries = instance => {
58
58
  };
59
59
  };
60
60
  exports.bindByHintTextQueries = bindByHintTextQueries;
61
- //# sourceMappingURL=hintText.js.map
61
+ //# sourceMappingURL=hint-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hint-text.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/hint-text.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/find-all';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\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,EAACJ,IAAI,EAAED,IAAI,CAACM,KAAK,CAACC,iBAAiB,EAAEH,UAAU,EAAED,KAAK,CAAC;AACvE,CAAC;AAED,MAAMK,kBAAkB,GACtBC,QAA2B,IAE3B,SAASC,oBAAoBA,CAACC,IAAI,EAAEC,YAAY,EAAE;EAChD,OAAO,IAAAC,gBAAO,EACZJ,QAAQ,EACPT,IAAI,IAAKD,iBAAiB,CAACC,IAAI,EAAEW,IAAI,EAAEC,YAAY,CAA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AA,CAAAlB,qBAAA,GAAAA,qBAAA"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import { CommonQueryOptions } from './options';
5
5
  type ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;
6
6
  export type ByLabelTextQueries = {
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByLabelTextQueries = void 0;
7
- var _findAll = require("../helpers/findAll");
8
- var _matchLabelText = require("../helpers/matchers/matchLabelText");
9
- var _makeQueries = require("./makeQueries");
7
+ var _findAll = require("../helpers/find-all");
8
+ var _matchLabelText = require("../helpers/matchers/match-label-text");
9
+ var _makeQueries = require("./make-queries");
10
10
  function queryAllByLabelText(instance) {
11
11
  return (text, queryOptions) => {
12
12
  return (0, _findAll.findAll)(instance, node => (0, _matchLabelText.matchLabelText)(instance, node, text, queryOptions), queryOptions);
@@ -31,4 +31,4 @@ const bindByLabelTextQueries = instance => ({
31
31
  findAllByLabelText: findAllBy(instance)
32
32
  });
33
33
  exports.bindByLabelTextQueries = bindByLabelTextQueries;
34
- //# sourceMappingURL=labelText.js.map
34
+ //# sourceMappingURL=label-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label-text.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/label-text.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/find-all';\nimport { TextMatch, TextMatchOptions } from '../matches';\nimport { matchLabelText } from '../helpers/matchers/match-label-text';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\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 accessibility label: ${String(labelText)} `;\nconst getMissingError = (labelText: TextMatch) =>\n `Unable to find an element with accessibility label: ${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,qDAAoDC,MAAM,CAACD,SAAS,CAAE,GAAE;AAC3E,MAAME,eAAe,GAAIF,SAAoB,IAC1C,uDAAsDC,MAAM,CAACD,SAAS,CAAE,EAAC;AAE5E,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"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
- import type { WaitForOptions } from '../waitFor';
2
+ import type { WaitForOptions } from '../wait-for';
3
3
  export type GetByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options) => ReactTestInstance;
4
4
  export type GetAllByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options) => ReactTestInstance[];
5
5
  export type QueryByQuery<Predicate, Options = void> = (predicate: Predicate, options?: Options) => ReactTestInstance | null;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.makeQueries = makeQueries;
7
7
  var _errors = require("../helpers/errors");
8
- var _waitFor = _interopRequireDefault(require("../waitFor"));
8
+ var _waitFor = _interopRequireDefault(require("../wait-for"));
9
9
  var _format = _interopRequireDefault(require("../helpers/format"));
10
10
  var _screen = require("../screen");
11
11
  var _formatDefault = require("../helpers/format-default");
@@ -140,4 +140,4 @@ function makeQueries(queryAllByQuery, getMissingError, getMultipleError) {
140
140
  findAllBy: findAllByQuery
141
141
  };
142
142
  }
143
- //# sourceMappingURL=makeQueries.js.map
143
+ //# sourceMappingURL=make-queries.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"make-queries.js","names":["_errors","require","_waitFor","_interopRequireDefault","_format","_screen","_formatDefault","obj","__esModule","default","deprecatedKeys","extractDeprecatedWaitForOptions","options","undefined","waitForOptions","timeout","interval","stackTraceError","forEach","key","option","console","warn","toString","formatErrorMessage","message","printElementTree","json","screen","toJSON","format","mapProps","defaultMapProps","appendElementTreeToError","error","oldMessage","stack","replace","makeQueries","queryAllByQuery","getMissingError","getMultipleError","getAllByQuery","instance","getAllFn","predicate","results","length","errorMessage","ErrorWithStack","queryByQuery","singleQueryFn","getByQuery","getFn","findAllByQuery","findAllFn","queryOptions","onTimeout","deprecatedWaitForOptions","waitFor","findByQuery","findFn","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy"],"sources":["../../src/queries/make-queries.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { ErrorWithStack } from '../helpers/errors';\nimport waitFor from '../wait-for';\nimport type { WaitForOptions } from '../wait-for';\nimport format from '../helpers/format';\nimport { screen } from '../screen';\nimport { defaultMapProps } from '../helpers/format-default';\n\nexport type GetByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance;\n\nexport type GetAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance[];\n\nexport type QueryByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance | null;\n\nexport type QueryAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n options?: Options\n) => ReactTestInstance[];\n\nexport type FindByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions\n) => Promise<ReactTestInstance>;\n\nexport type FindAllByQuery<Predicate, Options = void> = (\n predicate: Predicate,\n // Remove `& WaitForOptions` when all queries have been migrated to support 2nd arg query options.\n options?: Options & WaitForOptions,\n waitForOptions?: WaitForOptions\n) => Promise<ReactTestInstance[]>;\n\ntype UnboundQuery<Query> = (instance: ReactTestInstance) => Query;\n\nexport type UnboundQueries<Predicate, Options> = {\n getBy: UnboundQuery<GetByQuery<Predicate, Options>>;\n getAllBy: UnboundQuery<GetAllByQuery<Predicate, Options>>;\n queryBy: UnboundQuery<QueryByQuery<Predicate, Options>>;\n queryAllBy: UnboundQuery<QueryAllByQuery<Predicate, Options>>;\n findBy: UnboundQuery<FindByQuery<Predicate, Options>>;\n findAllBy: UnboundQuery<FindAllByQuery<Predicate, Options>>;\n};\n\nconst deprecatedKeys: (keyof WaitForOptions)[] = [\n 'timeout',\n 'interval',\n 'stackTraceError',\n];\n\n// The WaitForOptions has been moved to the second option param of findBy* methods with the adding of TextMatchOptions\n// To make the migration easier and avoid a breaking change, keep reading this options from the first param but warn\nfunction extractDeprecatedWaitForOptions(options?: WaitForOptions) {\n if (!options) {\n return undefined;\n }\n\n const waitForOptions: WaitForOptions = {\n timeout: options.timeout,\n interval: options.interval,\n stackTraceError: options.stackTraceError,\n };\n\n deprecatedKeys.forEach((key) => {\n const option = options[key];\n if (option) {\n // eslint-disable-next-line no-console\n console.warn(\n `Use of option \"${key}\" in a findBy* query options (2nd parameter) is deprecated. Please pass this option in the waitForOptions (3rd parameter).\nExample:\n\n findByText(text, {}, { ${key}: ${option.toString()} })`\n );\n }\n });\n\n return waitForOptions;\n}\n\nfunction formatErrorMessage(message: string, printElementTree: boolean) {\n if (!printElementTree) {\n return message;\n }\n\n const json = screen.toJSON();\n if (!json) {\n return message;\n }\n\n return `${message}\\n\\n${format(json, {\n mapProps: defaultMapProps,\n })}`;\n}\n\nfunction appendElementTreeToError(error: Error) {\n const oldMessage = error.message;\n error.message = formatErrorMessage(oldMessage, true);\n\n // Required to make Jest print the element tree on error\n error.stack = error.stack?.replace(oldMessage, error.message);\n\n return error;\n}\n\nexport function makeQueries<Predicate, Options>(\n queryAllByQuery: UnboundQuery<QueryAllByQuery<Predicate, Options>>,\n getMissingError: (predicate: Predicate, options?: Options) => string,\n getMultipleError: (predicate: Predicate, options?: Options) => string\n): UnboundQueries<Predicate, Options> {\n function getAllByQuery(\n instance: ReactTestInstance,\n { printElementTree = true } = {}\n ) {\n return function getAllFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length === 0) {\n const errorMessage = formatErrorMessage(\n getMissingError(predicate, options),\n printElementTree\n );\n throw new ErrorWithStack(errorMessage, getAllFn);\n }\n\n return results;\n };\n }\n\n function queryByQuery(\n instance: ReactTestInstance,\n { printElementTree = true } = {}\n ) {\n return function singleQueryFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(\n formatErrorMessage(\n getMultipleError(predicate, options),\n printElementTree\n ),\n singleQueryFn\n );\n }\n\n if (results.length === 0) {\n return null;\n }\n\n return results[0];\n };\n }\n\n function getByQuery(\n instance: ReactTestInstance,\n { printElementTree = true } = {}\n ) {\n return function getFn(predicate: Predicate, options?: Options) {\n const results = queryAllByQuery(instance)(predicate, options);\n\n if (results.length > 1) {\n throw new ErrorWithStack(getMultipleError(predicate, options), getFn);\n }\n\n if (results.length === 0) {\n const errorMessage = formatErrorMessage(\n getMissingError(predicate, options),\n printElementTree\n );\n throw new ErrorWithStack(errorMessage, getFn);\n }\n\n return results[0];\n };\n }\n\n function findAllByQuery(instance: ReactTestInstance) {\n return function findAllFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n {\n onTimeout = (error) => appendElementTreeToError(error),\n ...waitForOptions\n }: WaitForOptions = {}\n ) {\n const stackTraceError = new ErrorWithStack(\n 'STACK_TRACE_ERROR',\n findAllFn\n );\n const deprecatedWaitForOptions =\n extractDeprecatedWaitForOptions(queryOptions);\n\n return waitFor(\n () =>\n getAllByQuery(instance, { printElementTree: false })(\n predicate,\n queryOptions\n ),\n {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n stackTraceError,\n onTimeout,\n }\n );\n };\n }\n\n function findByQuery(instance: ReactTestInstance) {\n return function findFn(\n predicate: Predicate,\n queryOptions?: Options & WaitForOptions,\n {\n onTimeout = (error) => appendElementTreeToError(error),\n ...waitForOptions\n }: WaitForOptions = {}\n ) {\n const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', findFn);\n const deprecatedWaitForOptions =\n extractDeprecatedWaitForOptions(queryOptions);\n\n return waitFor(\n () =>\n getByQuery(instance, { printElementTree: false })(\n predicate,\n queryOptions\n ),\n {\n ...deprecatedWaitForOptions,\n ...waitForOptions,\n stackTraceError,\n onTimeout,\n }\n );\n };\n }\n\n return {\n getBy: getByQuery,\n getAllBy: getAllByQuery,\n queryBy: queryByQuery,\n queryAllBy: queryAllByQuery,\n findBy: findByQuery,\n findAllBy: findAllByQuery,\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AAA4D,SAAAE,uBAAAI,G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wC;MACF,CACF,CAAC;IACH,CAAC;EACH;EAEA,SAASG,WAAWA,CAACjB,QAA2B,EAAE;IAChD,OAAO,SAASkB,MAAMA,CACpBhB,SAAoB,EACpBW,YAAuC,EACvC;MACEC,SAAS,GAAIvB,KAAK,IAAKD,wBAAwB,CAACC,KAAK,CAAC;MACtD,GAAGpB;IACW,CAAC,GAAG,CAAC,CAAC,EACtB;MACA,MAAMG,eAAe,GAAG,IAAIgC,sBAAc,CAAC,mBAAmB,EAAEY,MAAM,CAAC;MACvE,MAAMH,wBAAwB,GAC5B/C,+BAA+B,CAAC6C,YAAY,CAAC;MAE/C,OAAO,IAAAG,gBAAO,EACZ,MACEP,UAAU,CAACT,QAAQ,EAAE;QAAEjB,gBAAgB,EAAE;MAAM,CAAC,CAAC,CAC/CmB,SAAS,EACTW,YACF,CAAC,EACH;QACE,GAAGE,wBAAwB;QAC3B,GAAG5C,cAAc;QACjBG,eAAe;QACfwC;MACF,CACF,CAAC;IACH,CAAC;EACH;EAEA,OAAO;IACLK,KAAK,EAAEV,UAAU;IACjBW,QAAQ,EAAErB,aAAa;IACvBsB,OAAO,EAAEd,YAAY;IACrBe,UAAU,EAAE1B,eAAe;IAC3B2B,MAAM,EAAEN,WAAW;IACnBO,SAAS,EAAEb;EACb,CAAC;AACH"}
@@ -1,6 +1,6 @@
1
1
  import type { ReactTestInstance } from 'react-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../matches';
3
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
3
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import type { CommonQueryOptions } from './options';
5
5
  type ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;
6
6
  export type ByPlaceholderTextQueries = {
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.bindByPlaceholderTextQueries = void 0;
7
- var _findAll = require("../helpers/findAll");
7
+ var _findAll = require("../helpers/find-all");
8
8
  var _matches = require("../matches");
9
9
  var _hostComponentNames = require("../helpers/host-component-names");
10
- var _makeQueries = require("./makeQueries");
10
+ var _makeQueries = require("./make-queries");
11
11
  const matchPlaceholderText = (node, placeholder, options = {}) => {
12
12
  const {
13
13
  exact,
@@ -37,4 +37,4 @@ const bindByPlaceholderTextQueries = instance => ({
37
37
  findAllByPlaceholderText: findAllBy(instance)
38
38
  });
39
39
  exports.bindByPlaceholderTextQueries = bindByPlaceholderTextQueries;
40
- //# sourceMappingURL=placeholderText.js.map
40
+ //# sourceMappingURL=placeholder-text.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placeholder-text.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/placeholder-text.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { findAll } from '../helpers/find-all';\nimport { matches, TextMatch, TextMatchOptions } from '../matches';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\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,CAA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test-renderer';
2
- import { AccessibilityStateMatcher } from '../helpers/matchers/accessibilityState';
3
- import { AccessibilityValueMatcher } from '../helpers/matchers/accessibilityValue';
2
+ import { AccessibilityStateMatcher } from '../helpers/matchers/match-accessibility-state';
3
+ import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
4
4
  import type { TextMatch } from '../matches';
5
- import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './makeQueries';
5
+ import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
6
6
  import { CommonQueryOptions } from './options';
7
7
  type ByRoleOptions = CommonQueryOptions & AccessibilityStateMatcher & {
8
8
  name?: TextMatch;