@testing-library/react-native 13.0.0-alpha.2 → 14.0.0-alpha.0

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 (148) hide show
  1. package/build/act.d.ts +4 -3
  2. package/build/act.js +1 -6
  3. package/build/act.js.map +1 -1
  4. package/build/config.d.ts +1 -11
  5. package/build/config.js +1 -2
  6. package/build/config.js.map +1 -1
  7. package/build/fire-event.d.ts +7 -7
  8. package/build/fire-event.js +26 -4
  9. package/build/fire-event.js.map +1 -1
  10. package/build/helpers/accessibility.d.ts +14 -14
  11. package/build/helpers/accessibility.js +2 -2
  12. package/build/helpers/accessibility.js.map +1 -1
  13. package/build/helpers/component-tree.d.ts +7 -31
  14. package/build/helpers/component-tree.js +15 -73
  15. package/build/helpers/component-tree.js.map +1 -1
  16. package/build/helpers/debug.d.ts +2 -2
  17. package/build/helpers/debug.js.map +1 -1
  18. package/build/helpers/find-all.d.ts +2 -3
  19. package/build/helpers/find-all.js +5 -5
  20. package/build/helpers/find-all.js.map +1 -1
  21. package/build/helpers/format.d.ts +3 -3
  22. package/build/helpers/format.js.map +1 -1
  23. package/build/helpers/host-component-names.d.ts +7 -8
  24. package/build/helpers/host-component-names.js +7 -6
  25. package/build/helpers/host-component-names.js.map +1 -1
  26. package/build/helpers/matchers/match-accessibility-state.d.ts +2 -2
  27. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  28. package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
  29. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  30. package/build/helpers/matchers/match-label-text.d.ts +2 -2
  31. package/build/helpers/matchers/match-label-text.js.map +1 -1
  32. package/build/helpers/matchers/match-text-content.d.ts +2 -2
  33. package/build/helpers/matchers/match-text-content.js.map +1 -1
  34. package/build/helpers/pointer-events.d.ts +2 -2
  35. package/build/helpers/pointer-events.js +1 -2
  36. package/build/helpers/pointer-events.js.map +1 -1
  37. package/build/helpers/text-content.d.ts +2 -2
  38. package/build/helpers/text-content.js.map +1 -1
  39. package/build/helpers/text-input.d.ts +3 -3
  40. package/build/helpers/text-input.js.map +1 -1
  41. package/build/helpers/wrap-async.d.ts +1 -0
  42. package/build/helpers/wrap-async.js +1 -0
  43. package/build/helpers/wrap-async.js.map +1 -1
  44. package/build/index.d.ts +1 -0
  45. package/build/index.flow.js +0 -1
  46. package/build/index.js +11 -0
  47. package/build/index.js.map +1 -1
  48. package/build/matchers/to-be-busy.d.ts +2 -2
  49. package/build/matchers/to-be-busy.js.map +1 -1
  50. package/build/matchers/to-be-checked.d.ts +2 -2
  51. package/build/matchers/to-be-checked.js.map +1 -1
  52. package/build/matchers/to-be-disabled.d.ts +3 -3
  53. package/build/matchers/to-be-disabled.js +1 -2
  54. package/build/matchers/to-be-disabled.js.map +1 -1
  55. package/build/matchers/to-be-empty-element.d.ts +2 -2
  56. package/build/matchers/to-be-empty-element.js +1 -2
  57. package/build/matchers/to-be-empty-element.js.map +1 -1
  58. package/build/matchers/to-be-expanded.d.ts +3 -3
  59. package/build/matchers/to-be-expanded.js.map +1 -1
  60. package/build/matchers/to-be-on-the-screen.d.ts +2 -2
  61. package/build/matchers/to-be-on-the-screen.js +1 -1
  62. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  63. package/build/matchers/to-be-partially-checked.d.ts +2 -2
  64. package/build/matchers/to-be-partially-checked.js.map +1 -1
  65. package/build/matchers/to-be-selected.d.ts +2 -2
  66. package/build/matchers/to-be-selected.js.map +1 -1
  67. package/build/matchers/to-be-visible.d.ts +2 -2
  68. package/build/matchers/to-be-visible.js +1 -2
  69. package/build/matchers/to-be-visible.js.map +1 -1
  70. package/build/matchers/to-contain-element.d.ts +2 -2
  71. package/build/matchers/to-contain-element.js +2 -1
  72. package/build/matchers/to-contain-element.js.map +1 -1
  73. package/build/matchers/to-have-accessibility-value.d.ts +2 -2
  74. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  75. package/build/matchers/to-have-accessible-name.d.ts +2 -2
  76. package/build/matchers/to-have-accessible-name.js.map +1 -1
  77. package/build/matchers/to-have-display-value.d.ts +2 -2
  78. package/build/matchers/to-have-display-value.js.map +1 -1
  79. package/build/matchers/to-have-prop.d.ts +2 -2
  80. package/build/matchers/to-have-prop.js.map +1 -1
  81. package/build/matchers/to-have-style.d.ts +2 -2
  82. package/build/matchers/to-have-style.js.map +1 -1
  83. package/build/matchers/to-have-text-content.d.ts +2 -2
  84. package/build/matchers/to-have-text-content.js.map +1 -1
  85. package/build/matchers/types.d.ts +2 -2
  86. package/build/matchers/types.js.map +1 -1
  87. package/build/matchers/utils.d.ts +5 -5
  88. package/build/matchers/utils.js +10 -6
  89. package/build/matchers/utils.js.map +1 -1
  90. package/build/native-state.d.ts +3 -3
  91. package/build/native-state.js.map +1 -1
  92. package/build/queries/display-value.d.ts +2 -2
  93. package/build/queries/display-value.js.map +1 -1
  94. package/build/queries/hint-text.d.ts +2 -2
  95. package/build/queries/hint-text.js.map +1 -1
  96. package/build/queries/label-text.d.ts +2 -2
  97. package/build/queries/label-text.js.map +1 -1
  98. package/build/queries/make-queries.d.ts +9 -9
  99. package/build/queries/make-queries.js +2 -2
  100. package/build/queries/make-queries.js.map +1 -1
  101. package/build/queries/placeholder-text.d.ts +2 -2
  102. package/build/queries/placeholder-text.js.map +1 -1
  103. package/build/queries/role.d.ts +2 -2
  104. package/build/queries/role.js.map +1 -1
  105. package/build/queries/test-id.d.ts +2 -2
  106. package/build/queries/test-id.js.map +1 -1
  107. package/build/queries/text.d.ts +2 -2
  108. package/build/queries/text.js.map +1 -1
  109. package/build/render.d.ts +47 -85
  110. package/build/render.js +25 -69
  111. package/build/render.js.map +1 -1
  112. package/build/screen.js +1 -9
  113. package/build/screen.js.map +1 -1
  114. package/build/tsconfig.release.tsbuildinfo +1 -1
  115. package/build/user-event/clear.d.ts +2 -2
  116. package/build/user-event/clear.js.map +1 -1
  117. package/build/user-event/index.d.ts +7 -7
  118. package/build/user-event/index.js.map +1 -1
  119. package/build/user-event/paste.d.ts +2 -2
  120. package/build/user-event/paste.js.map +1 -1
  121. package/build/user-event/press/press.d.ts +3 -3
  122. package/build/user-event/press/press.js +1 -2
  123. package/build/user-event/press/press.js.map +1 -1
  124. package/build/user-event/scroll/scroll-to.d.ts +2 -2
  125. package/build/user-event/scroll/scroll-to.js.map +1 -1
  126. package/build/user-event/setup/setup.d.ts +7 -7
  127. package/build/user-event/setup/setup.js.map +1 -1
  128. package/build/user-event/type/type.d.ts +3 -3
  129. package/build/user-event/type/type.js.map +1 -1
  130. package/build/user-event/utils/dispatch-event.d.ts +2 -2
  131. package/build/user-event/utils/dispatch-event.js.map +1 -1
  132. package/build/within.d.ts +20 -36
  133. package/build/within.js +7 -11
  134. package/build/within.js.map +1 -1
  135. package/package.json +10 -11
  136. package/typings/index.flow.js +0 -1
  137. package/build/helpers/string-validation.d.ts +0 -2
  138. package/build/helpers/string-validation.js +0 -31
  139. package/build/helpers/string-validation.js.map +0 -1
  140. package/build/queries/unsafe-props.d.ts +0 -16
  141. package/build/queries/unsafe-props.js +0 -49
  142. package/build/queries/unsafe-props.js.map +0 -1
  143. package/build/queries/unsafe-type.d.ts +0 -9
  144. package/build/queries/unsafe-type.js +0 -47
  145. package/build/queries/unsafe-type.js.map +0 -1
  146. package/build/render-act.d.ts +0 -2
  147. package/build/render-act.js +0 -22
  148. package/build/render-act.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import type { ReactTestRendererJSON } from 'react-test-renderer';
1
+ import type { JsonNode } from 'universal-test-renderer';
2
2
  import { FormatOptions } from './format';
3
3
  export type DebugOptions = {
4
4
  message?: string;
@@ -6,4 +6,4 @@ export type DebugOptions = {
6
6
  /**
7
7
  * Log pretty-printed deep test component instance
8
8
  */
9
- export declare function debug(instance: ReactTestRendererJSON | ReactTestRendererJSON[], options?: DebugOptions | string): void;
9
+ export declare function debug(instance: JsonNode | JsonNode[], options?: DebugOptions | string): void;
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","names":["_format","_interopRequireDefault","require","e","__esModule","default","debug","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport format, { FormatOptions } from './format';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport function debug(\n instance: ReactTestRendererJSON | ReactTestRendererJSON[],\n options?: DebugOptions | string,\n) {\n const message = typeof options === 'string' ? options : options?.message;\n\n const formatOptions = typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(instance, formatOptions));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMjD;AACA;AACA;AACO,SAASG,KAAKA,CACnBC,QAAyD,EACzDC,OAA+B,EAC/B;EACA,MAAMC,OAAO,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,EAAEC,OAAO;EAExE,MAAMC,aAAa,GAAG,OAAOF,OAAO,KAAK,QAAQ,GAAG;IAAEG,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC,GAAGC,SAAS;EAE/F,IAAIH,OAAO,EAAE;IACX;IACAI,OAAO,CAACC,GAAG,CAAC,GAAGL,OAAO,MAAM,EAAE,IAAAM,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACL;IACAG,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAC9C;AACF","ignoreList":[]}
1
+ {"version":3,"file":"debug.js","names":["_format","_interopRequireDefault","require","e","__esModule","default","debug","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type { JsonNode } from 'universal-test-renderer';\nimport format, { FormatOptions } from './format';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport function debug(instance: JsonNode | JsonNode[], options?: DebugOptions | string) {\n const message = typeof options === 'string' ? options : options?.message;\n\n const formatOptions = typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(instance, formatOptions));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMjD;AACA;AACA;AACO,SAASG,KAAKA,CAACC,QAA+B,EAAEC,OAA+B,EAAE;EACtF,MAAMC,OAAO,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,EAAEC,OAAO;EAExE,MAAMC,aAAa,GAAG,OAAOF,OAAO,KAAK,QAAQ,GAAG;IAAEG,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC,GAAGC,SAAS;EAE/F,IAAIH,OAAO,EAAE;IACX;IACAI,OAAO,CAACC,GAAG,CAAC,GAAGL,OAAO,MAAM,EAAE,IAAAM,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACL;IACAG,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAC9C;AACF","ignoreList":[]}
@@ -1,5 +1,4 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- import { HostTestInstance } from './component-tree';
1
+ import { HostElement } from 'universal-test-renderer';
3
2
  interface FindAllOptions {
4
3
  /** Match elements hidden from accessibility */
5
4
  includeHiddenElements?: boolean;
@@ -7,5 +6,5 @@ interface FindAllOptions {
7
6
  hidden?: boolean;
8
7
  matchDeepestOnly?: boolean;
9
8
  }
10
- export declare function findAll(root: ReactTestInstance, predicate: (element: ReactTestInstance) => boolean, options?: FindAllOptions): HostTestInstance[];
9
+ export declare function findAll(root: HostElement, predicate: (element: HostElement) => boolean, options?: FindAllOptions): HostElement[];
11
10
  export {};
@@ -21,21 +21,21 @@ function findAll(root, predicate, options) {
21
21
 
22
22
  // Extracted from React Test Renderer
23
23
  // src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402
24
- function findAllInternal(root, predicate, options) {
24
+ function findAllInternal(node, predicate, options, indent = '') {
25
25
  const results = [];
26
26
 
27
27
  // Match descendants first but do not add them to results yet.
28
28
  const matchingDescendants = [];
29
- root.children.forEach(child => {
29
+ node.children.forEach(child => {
30
30
  if (typeof child === 'string') {
31
31
  return;
32
32
  }
33
- matchingDescendants.push(...findAllInternal(child, predicate, options));
33
+ matchingDescendants.push(...findAllInternal(child, predicate, options, indent + ' '));
34
34
  });
35
35
  if (
36
36
  // When matchDeepestOnly = true: add current element only if no descendants match
37
- (!options?.matchDeepestOnly || matchingDescendants.length === 0) && (0, _componentTree.isHostElement)(root) && predicate(root)) {
38
- results.push(root);
37
+ (!options?.matchDeepestOnly || matchingDescendants.length === 0) && (0, _componentTree.isValidElement)(node) && predicate(node)) {
38
+ results.push(node);
39
39
  }
40
40
 
41
41
  // Add matching descendants after element to preserve original tree walk order.
@@ -1 +1 @@
1
- {"version":3,"file":"find-all.js","names":["_config","require","_accessibility","_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/find-all.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessibility';\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 ?? options?.hidden ?? getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<ReactTestInstance>();\n return results.filter((element) => !isHiddenFromAccessibility(element, { cache }));\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,cAAA,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,IAAIH,OAAO,EAAEI,MAAM,IAAI,IAAAC,iBAAS,EAAC,CAAC,EAAEC,4BAA4B;EAEhG,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,CAAoB,CAAC;EAC9C,OAAOP,OAAO,CAACQ,MAAM,CAAEC,OAAO,IAAK,CAAC,IAAAC,wCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAAC,CAAC;AACpF;;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","ignoreList":[]}
1
+ {"version":3,"file":"find-all.js","names":["_config","require","_accessibility","_componentTree","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","node","indent","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length","isValidElement"],"sources":["../../src/helpers/find-all.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessibility';\nimport { isValidElement } 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: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: FindAllOptions,\n): HostElement[] {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ?? options?.hidden ?? getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<HostElement>();\n return results.filter((element) => !isHiddenFromAccessibility(element, { cache }));\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 node: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: FindAllOptions,\n indent: string = '',\n): HostElement[] {\n const results: HostElement[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostElement[] = [];\n node.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options, indent + ' '));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n isValidElement(node) &&\n predicate(node)\n ) {\n results.push(node);\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,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAaO,SAASG,OAAOA,CACrBC,IAAiB,EACjBC,SAA4C,EAC5CC,OAAwB,EACT;EACf,MAAMC,OAAO,GAAGC,eAAe,CAACJ,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAEzD,MAAMG,qBAAqB,GACzBH,OAAO,EAAEG,qBAAqB,IAAIH,OAAO,EAAEI,MAAM,IAAI,IAAAC,iBAAS,EAAC,CAAC,EAAEC,4BAA4B;EAEhG,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,CAAc,CAAC;EACxC,OAAOP,OAAO,CAACQ,MAAM,CAAEC,OAAO,IAAK,CAAC,IAAAC,wCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAAC,CAAC;AACpF;;AAEA;AACA;AACA,SAASL,eAAeA,CACtBU,IAAiB,EACjBb,SAA4C,EAC5CC,OAAwB,EACxBa,MAAc,GAAG,EAAE,EACJ;EACf,MAAMZ,OAAsB,GAAG,EAAE;;EAEjC;EACA,MAAMa,mBAAkC,GAAG,EAAE;EAC7CF,IAAI,CAACG,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC/B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IACAH,mBAAmB,CAACI,IAAI,CAAC,GAAGhB,eAAe,CAACe,KAAK,EAAElB,SAAS,EAAEC,OAAO,EAAEa,MAAM,GAAG,IAAI,CAAC,CAAC;EACxF,CAAC,CAAC;EAEF;EACE;EACA,CAAC,CAACb,OAAO,EAAEmB,gBAAgB,IAAIL,mBAAmB,CAACM,MAAM,KAAK,CAAC,KAC/D,IAAAC,6BAAc,EAACT,IAAI,CAAC,IACpBb,SAAS,CAACa,IAAI,CAAC,EACf;IACAX,OAAO,CAACiB,IAAI,CAACN,IAAI,CAAC;EACpB;;EAEA;EACAX,OAAO,CAACiB,IAAI,CAAC,GAAGJ,mBAAmB,CAAC;EAEpC,OAAOb,OAAO;AAChB","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import type { ReactTestRendererJSON } from 'react-test-renderer';
2
- export type MapPropsFunction = (props: Record<string, unknown>, node: ReactTestRendererJSON) => Record<string, unknown>;
1
+ import { JsonElement, JsonNode } from 'universal-test-renderer';
2
+ export type MapPropsFunction = (props: Record<string, unknown>, node: JsonElement) => Record<string, unknown>;
3
3
  export type FormatOptions = {
4
4
  mapProps?: MapPropsFunction;
5
5
  };
6
- declare const format: (input: ReactTestRendererJSON | ReactTestRendererJSON[], options?: FormatOptions) => string;
6
+ declare const format: (input: JsonNode | JsonNode[], options?: FormatOptions) => string;
7
7
  export default format;
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","names":["_prettyFormat","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","format","input","options","prettyFormat","plugins","getCustomPlugin","mapProps","ReactElement","highlight","printBasicPrototype","test","val","ReactTestComponent","serialize","config","indentation","depth","refs","printer","newVal","props","_default","exports"],"sources":["../../src/helpers/format.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport prettyFormat, { NewPlugin, plugins } from 'pretty-format';\n\nexport type MapPropsFunction = (\n props: Record<string, unknown>,\n node: ReactTestRendererJSON,\n) => Record<string, unknown>;\n\nexport type FormatOptions = {\n mapProps?: MapPropsFunction;\n};\n\nconst format = (\n input: ReactTestRendererJSON | ReactTestRendererJSON[],\n options: FormatOptions = {},\n) =>\n prettyFormat(input, {\n plugins: [getCustomPlugin(options.mapProps), plugins.ReactElement],\n highlight: true,\n printBasicPrototype: false,\n });\n\nconst getCustomPlugin = (mapProps?: MapPropsFunction): NewPlugin => {\n return {\n test: (val) => plugins.ReactTestComponent.test(val),\n serialize: (val, config, indentation, depth, refs, printer) => {\n let newVal = val;\n if (mapProps && val.props) {\n newVal = { ...val, props: mapProps(val.props, val) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer,\n );\n },\n };\n};\n\nexport default format;\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiE,SAAAC,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,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAWjE,MAAMW,MAAM,GAAGA,CACbC,KAAsD,EACtDC,OAAsB,GAAG,CAAC,CAAC,KAE3B,IAAAC,qBAAY,EAACF,KAAK,EAAE;EAClBG,OAAO,EAAE,CAACC,eAAe,CAACH,OAAO,CAACI,QAAQ,CAAC,EAAEF,qBAAO,CAACG,YAAY,CAAC;EAClEC,SAAS,EAAE,IAAI;EACfC,mBAAmB,EAAE;AACvB,CAAC,CAAC;AAEJ,MAAMJ,eAAe,GAAIC,QAA2B,IAAgB;EAClE,OAAO;IACLI,IAAI,EAAGC,GAAG,IAAKP,qBAAO,CAACQ,kBAAkB,CAACF,IAAI,CAACC,GAAG,CAAC;IACnDE,SAAS,EAAEA,CAACF,GAAG,EAAEG,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,KAAK;MAC7D,IAAIC,MAAM,GAAGR,GAAG;MAChB,IAAIL,QAAQ,IAAIK,GAAG,CAACS,KAAK,EAAE;QACzBD,MAAM,GAAG;UAAE,GAAGR,GAAG;UAAES,KAAK,EAAEd,QAAQ,CAACK,GAAG,CAACS,KAAK,EAAET,GAAG;QAAE,CAAC;MACtD;MACA,OAAOP,qBAAO,CAACQ,kBAAkB,CAACC,SAAS,CACzCM,MAAM,EACNL,MAAM,EACNC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,OACF,CAAC;IACH;EACF,CAAC;AACH,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAApC,OAAA,GAEac,MAAM","ignoreList":[]}
1
+ {"version":3,"file":"format.js","names":["_prettyFormat","_interopRequireWildcard","require","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","format","input","options","prettyFormat","plugins","getCustomPlugin","mapProps","ReactElement","highlight","printBasicPrototype","test","val","ReactTestComponent","serialize","config","indentation","depth","refs","printer","newVal","props","_default","exports"],"sources":["../../src/helpers/format.ts"],"sourcesContent":["import prettyFormat, { NewPlugin, plugins } from 'pretty-format';\nimport { JsonElement, JsonNode } from 'universal-test-renderer';\n\nexport type MapPropsFunction = (\n props: Record<string, unknown>,\n node: JsonElement,\n) => Record<string, unknown>;\n\nexport type FormatOptions = {\n mapProps?: MapPropsFunction;\n};\n\nconst format = (input: JsonNode | JsonNode[], options: FormatOptions = {}) =>\n prettyFormat(input, {\n plugins: [getCustomPlugin(options.mapProps), plugins.ReactElement],\n highlight: true,\n printBasicPrototype: false,\n });\n\nconst getCustomPlugin = (mapProps?: MapPropsFunction): NewPlugin => {\n return {\n test: (val) => plugins.ReactTestComponent.test(val),\n serialize: (val, config, indentation, depth, refs, printer) => {\n let newVal = val;\n if (mapProps && val.props) {\n newVal = { ...val, props: mapProps(val.props, val) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer,\n );\n },\n };\n};\n\nexport default format;\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAAiE,SAAAC,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,SAAAH,wBAAAG,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAYjE,MAAMW,MAAM,GAAGA,CAACC,KAA4B,EAAEC,OAAsB,GAAG,CAAC,CAAC,KACvE,IAAAC,qBAAY,EAACF,KAAK,EAAE;EAClBG,OAAO,EAAE,CAACC,eAAe,CAACH,OAAO,CAACI,QAAQ,CAAC,EAAEF,qBAAO,CAACG,YAAY,CAAC;EAClEC,SAAS,EAAE,IAAI;EACfC,mBAAmB,EAAE;AACvB,CAAC,CAAC;AAEJ,MAAMJ,eAAe,GAAIC,QAA2B,IAAgB;EAClE,OAAO;IACLI,IAAI,EAAGC,GAAG,IAAKP,qBAAO,CAACQ,kBAAkB,CAACF,IAAI,CAACC,GAAG,CAAC;IACnDE,SAAS,EAAEA,CAACF,GAAG,EAAEG,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,KAAK;MAC7D,IAAIC,MAAM,GAAGR,GAAG;MAChB,IAAIL,QAAQ,IAAIK,GAAG,CAACS,KAAK,EAAE;QACzBD,MAAM,GAAG;UAAE,GAAGR,GAAG;UAAES,KAAK,EAAEd,QAAQ,CAACK,GAAG,CAACS,KAAK,EAAET,GAAG;QAAE,CAAC;MACtD;MACA,OAAOP,qBAAO,CAACQ,kBAAkB,CAACC,SAAS,CACzCM,MAAM,EACNL,MAAM,EACNC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,OACF,CAAC;IACH;EACF,CAAC;AACH,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAApC,OAAA,GAEac,MAAM","ignoreList":[]}
@@ -1,32 +1,31 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- import { HostTestInstance } from './component-tree';
1
+ import { HostElement } from 'universal-test-renderer';
3
2
  /**
4
3
  * Checks if the given element is a host Text element.
5
4
  * @param element The element to check.
6
5
  */
7
- export declare function isHostText(element: ReactTestInstance): element is HostTestInstance;
6
+ export declare function isHostText(element: HostElement | null): boolean;
8
7
  /**
9
8
  * Checks if the given element is a host TextInput element.
10
9
  * @param element The element to check.
11
10
  */
12
- export declare function isHostTextInput(element: ReactTestInstance): element is HostTestInstance;
11
+ export declare function isHostTextInput(element: HostElement | null): boolean;
13
12
  /**
14
13
  * Checks if the given element is a host Image element.
15
14
  * @param element The element to check.
16
15
  */
17
- export declare function isHostImage(element: ReactTestInstance): element is HostTestInstance;
16
+ export declare function isHostImage(element: HostElement | null): boolean;
18
17
  /**
19
18
  * Checks if the given element is a host Switch element.
20
19
  * @param element The element to check.
21
20
  */
22
- export declare function isHostSwitch(element: ReactTestInstance): element is HostTestInstance;
21
+ export declare function isHostSwitch(element: HostElement | null): boolean;
23
22
  /**
24
23
  * Checks if the given element is a host ScrollView element.
25
24
  * @param element The element to check.
26
25
  */
27
- export declare function isHostScrollView(element: ReactTestInstance): element is HostTestInstance;
26
+ export declare function isHostScrollView(element: HostElement | null): boolean;
28
27
  /**
29
28
  * Checks if the given element is a host Modal element.
30
29
  * @param element The element to check.
31
30
  */
32
- export declare function isHostModal(element: ReactTestInstance): element is HostTestInstance;
31
+ export declare function isHostModal(element: HostElement | null): boolean;
@@ -9,6 +9,7 @@ exports.isHostScrollView = isHostScrollView;
9
9
  exports.isHostSwitch = isHostSwitch;
10
10
  exports.isHostText = isHostText;
11
11
  exports.isHostTextInput = isHostTextInput;
12
+ var _componentTree = require("./component-tree");
12
13
  const HOST_TEXT_NAMES = ['Text', 'RCTText'];
13
14
  const HOST_TEXT_INPUT_NAMES = ['TextInput'];
14
15
  const HOST_IMAGE_NAMES = ['Image'];
@@ -21,7 +22,7 @@ const HOST_MODAL_NAMES = ['Modal'];
21
22
  * @param element The element to check.
22
23
  */
23
24
  function isHostText(element) {
24
- return typeof element?.type === 'string' && HOST_TEXT_NAMES.includes(element.type);
25
+ return (0, _componentTree.isValidElement)(element) && HOST_TEXT_NAMES.includes(element.type);
25
26
  }
26
27
 
27
28
  /**
@@ -29,7 +30,7 @@ function isHostText(element) {
29
30
  * @param element The element to check.
30
31
  */
31
32
  function isHostTextInput(element) {
32
- return typeof element?.type === 'string' && HOST_TEXT_INPUT_NAMES.includes(element.type);
33
+ return (0, _componentTree.isValidElement)(element) && HOST_TEXT_INPUT_NAMES.includes(element.type);
33
34
  }
34
35
 
35
36
  /**
@@ -37,7 +38,7 @@ function isHostTextInput(element) {
37
38
  * @param element The element to check.
38
39
  */
39
40
  function isHostImage(element) {
40
- return typeof element?.type === 'string' && HOST_IMAGE_NAMES.includes(element.type);
41
+ return (0, _componentTree.isValidElement)(element) && HOST_IMAGE_NAMES.includes(element.type);
41
42
  }
42
43
 
43
44
  /**
@@ -45,7 +46,7 @@ function isHostImage(element) {
45
46
  * @param element The element to check.
46
47
  */
47
48
  function isHostSwitch(element) {
48
- return typeof element?.type === 'string' && HOST_SWITCH_NAMES.includes(element.type);
49
+ return (0, _componentTree.isValidElement)(element) && HOST_SWITCH_NAMES.includes(element.type);
49
50
  }
50
51
 
51
52
  /**
@@ -53,7 +54,7 @@ function isHostSwitch(element) {
53
54
  * @param element The element to check.
54
55
  */
55
56
  function isHostScrollView(element) {
56
- return typeof element?.type === 'string' && HOST_SCROLL_VIEW_NAMES.includes(element.type);
57
+ return (0, _componentTree.isValidElement)(element) && HOST_SCROLL_VIEW_NAMES.includes(element.type);
57
58
  }
58
59
 
59
60
  /**
@@ -61,6 +62,6 @@ function isHostScrollView(element) {
61
62
  * @param element The element to check.
62
63
  */
63
64
  function isHostModal(element) {
64
- return typeof element?.type === 'string' && HOST_MODAL_NAMES.includes(element.type);
65
+ return (0, _componentTree.isValidElement)(element) && HOST_MODAL_NAMES.includes(element.type);
65
66
  }
66
67
  //# sourceMappingURL=host-component-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"host-component-names.js","names":["HOST_TEXT_NAMES","HOST_TEXT_INPUT_NAMES","HOST_IMAGE_NAMES","HOST_SWITCH_NAMES","HOST_SCROLL_VIEW_NAMES","HOST_MODAL_NAMES","isHostText","element","type","includes","isHostTextInput","isHostImage","isHostSwitch","isHostScrollView","isHostModal"],"sources":["../../src/helpers/host-component-names.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { HostTestInstance } from './component-tree';\n\nconst HOST_TEXT_NAMES = ['Text', 'RCTText'];\nconst HOST_TEXT_INPUT_NAMES = ['TextInput'];\nconst HOST_IMAGE_NAMES = ['Image'];\nconst HOST_SWITCH_NAMES = ['RCTSwitch'];\nconst HOST_SCROLL_VIEW_NAMES = ['RCTScrollView'];\nconst HOST_MODAL_NAMES = ['Modal'];\n\n/**\n * Checks if the given element is a host Text element.\n * @param element The element to check.\n */\nexport function isHostText(element: ReactTestInstance): element is HostTestInstance {\n return typeof element?.type === 'string' && HOST_TEXT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host TextInput element.\n * @param element The element to check.\n */\nexport function isHostTextInput(element: ReactTestInstance): element is HostTestInstance {\n return typeof element?.type === 'string' && HOST_TEXT_INPUT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Image element.\n * @param element The element to check.\n */\nexport function isHostImage(element: ReactTestInstance): element is HostTestInstance {\n return typeof element?.type === 'string' && HOST_IMAGE_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Switch element.\n * @param element The element to check.\n */\nexport function isHostSwitch(element: ReactTestInstance): element is HostTestInstance {\n return typeof element?.type === 'string' && HOST_SWITCH_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host ScrollView element.\n * @param element The element to check.\n */\nexport function isHostScrollView(element: ReactTestInstance): element is HostTestInstance {\n return typeof element?.type === 'string' && HOST_SCROLL_VIEW_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Modal element.\n * @param element The element to check.\n */\nexport function isHostModal(element: ReactTestInstance): element is HostTestInstance {\n return typeof element?.type === 'string' && HOST_MODAL_NAMES.includes(element.type);\n}\n"],"mappings":";;;;;;;;;;;AAGA,MAAMA,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAC3C,MAAMC,qBAAqB,GAAG,CAAC,WAAW,CAAC;AAC3C,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;AAClC,MAAMC,iBAAiB,GAAG,CAAC,WAAW,CAAC;AACvC,MAAMC,sBAAsB,GAAG,CAAC,eAAe,CAAC;AAChD,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;;AAElC;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAACC,OAA0B,EAA+B;EAClF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIR,eAAe,CAACS,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACpF;;AAEA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAACH,OAA0B,EAA+B;EACvF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIP,qBAAqB,CAACQ,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AAC1F;;AAEA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACJ,OAA0B,EAA+B;EACnF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIN,gBAAgB,CAACO,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACrF;;AAEA;AACA;AACA;AACA;AACO,SAASI,YAAYA,CAACL,OAA0B,EAA+B;EACpF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIL,iBAAiB,CAACM,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACtF;;AAEA;AACA;AACA;AACA;AACO,SAASK,gBAAgBA,CAACN,OAA0B,EAA+B;EACxF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIJ,sBAAsB,CAACK,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AAC3F;;AAEA;AACA;AACA;AACA;AACO,SAASM,WAAWA,CAACP,OAA0B,EAA+B;EACnF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIH,gBAAgB,CAACI,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACrF","ignoreList":[]}
1
+ {"version":3,"file":"host-component-names.js","names":["_componentTree","require","HOST_TEXT_NAMES","HOST_TEXT_INPUT_NAMES","HOST_IMAGE_NAMES","HOST_SWITCH_NAMES","HOST_SCROLL_VIEW_NAMES","HOST_MODAL_NAMES","isHostText","element","isValidElement","includes","type","isHostTextInput","isHostImage","isHostSwitch","isHostScrollView","isHostModal"],"sources":["../../src/helpers/host-component-names.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { isValidElement } from './component-tree';\n\nconst HOST_TEXT_NAMES = ['Text', 'RCTText'];\nconst HOST_TEXT_INPUT_NAMES = ['TextInput'];\nconst HOST_IMAGE_NAMES = ['Image'];\nconst HOST_SWITCH_NAMES = ['RCTSwitch'];\nconst HOST_SCROLL_VIEW_NAMES = ['RCTScrollView'];\nconst HOST_MODAL_NAMES = ['Modal'];\n\n/**\n * Checks if the given element is a host Text element.\n * @param element The element to check.\n */\nexport function isHostText(element: HostElement | null) {\n return isValidElement(element) && HOST_TEXT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host TextInput element.\n * @param element The element to check.\n */\nexport function isHostTextInput(element: HostElement | null) {\n return isValidElement(element) && HOST_TEXT_INPUT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Image element.\n * @param element The element to check.\n */\nexport function isHostImage(element: HostElement | null) {\n return isValidElement(element) && HOST_IMAGE_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Switch element.\n * @param element The element to check.\n */\nexport function isHostSwitch(element: HostElement | null) {\n return isValidElement(element) && HOST_SWITCH_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host ScrollView element.\n * @param element The element to check.\n */\nexport function isHostScrollView(element: HostElement | null) {\n return isValidElement(element) && HOST_SCROLL_VIEW_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Modal element.\n * @param element The element to check.\n */\nexport function isHostModal(element: HostElement | null) {\n return isValidElement(element) && HOST_MODAL_NAMES.includes(element.type);\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAC3C,MAAMC,qBAAqB,GAAG,CAAC,WAAW,CAAC;AAC3C,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;AAClC,MAAMC,iBAAiB,GAAG,CAAC,WAAW,CAAC;AACvC,MAAMC,sBAAsB,GAAG,CAAC,eAAe,CAAC;AAChD,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;;AAElC;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAACC,OAA2B,EAAE;EACtD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIP,eAAe,CAACS,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACJ,OAA2B,EAAE;EAC3D,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIN,qBAAqB,CAACQ,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAChF;;AAEA;AACA;AACA;AACA;AACO,SAASE,WAAWA,CAACL,OAA2B,EAAE;EACvD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIL,gBAAgB,CAACO,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAACN,OAA2B,EAAE;EACxD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIJ,iBAAiB,CAACM,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC5E;;AAEA;AACA;AACA;AACA;AACO,SAASI,gBAAgBA,CAACP,OAA2B,EAAE;EAC5D,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIH,sBAAsB,CAACK,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AACjF;;AAEA;AACA;AACA;AACA;AACO,SAASK,WAAWA,CAACR,OAA2B,EAAE;EACvD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIF,gBAAgB,CAACI,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC3E","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  export interface AccessibilityStateMatcher {
3
3
  disabled?: boolean;
4
4
  selected?: boolean;
@@ -6,4 +6,4 @@ export interface AccessibilityStateMatcher {
6
6
  busy?: boolean;
7
7
  expanded?: boolean;
8
8
  }
9
- export declare function matchAccessibilityState(node: ReactTestInstance, matcher: AccessibilityStateMatcher): boolean;
9
+ export declare function matchAccessibilityState(node: HostElement, matcher: AccessibilityStateMatcher): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"match-accessibility-state.js","names":["_accessibility","require","matchAccessibilityState","node","matcher","busy","undefined","computeAriaBusy","checked","computeAriaChecked","disabled","computeAriaDisabled","expanded","computeAriaExpanded","selected","computeAriaSelected"],"sources":["../../../src/helpers/matchers/match-accessibility-state.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport {\n computeAriaBusy,\n computeAriaChecked,\n computeAriaDisabled,\n computeAriaExpanded,\n computeAriaSelected,\n} from '../accessibility';\n\n// This type is the same as AccessibilityState from `react-native` package\n// It is re-declared here due to issues with migration from `@types/react-native` to\n// built in `react-native` types.\n// See: https://github.com/callstack/react-native-testing-library/issues/1351\nexport interface AccessibilityStateMatcher {\n disabled?: boolean;\n selected?: boolean;\n checked?: boolean | 'mixed';\n busy?: boolean;\n expanded?: boolean;\n}\n\nexport function matchAccessibilityState(\n node: ReactTestInstance,\n matcher: AccessibilityStateMatcher,\n) {\n if (matcher.busy !== undefined && matcher.busy !== computeAriaBusy(node)) {\n return false;\n }\n if (matcher.checked !== undefined && matcher.checked !== computeAriaChecked(node)) {\n return false;\n }\n if (matcher.disabled !== undefined && matcher.disabled !== computeAriaDisabled(node)) {\n return false;\n }\n if (matcher.expanded !== undefined && matcher.expanded !== computeAriaExpanded(node)) {\n return false;\n }\n if (matcher.selected !== undefined && matcher.selected !== computeAriaSelected(node)) {\n return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;;AASO,SAASC,uBAAuBA,CACrCC,IAAuB,EACvBC,OAAkC,EAClC;EACA,IAAIA,OAAO,CAACC,IAAI,KAAKC,SAAS,IAAIF,OAAO,CAACC,IAAI,KAAK,IAAAE,8BAAe,EAACJ,IAAI,CAAC,EAAE;IACxE,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACI,OAAO,KAAKF,SAAS,IAAIF,OAAO,CAACI,OAAO,KAAK,IAAAC,iCAAkB,EAACN,IAAI,CAAC,EAAE;IACjF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACM,QAAQ,KAAKJ,SAAS,IAAIF,OAAO,CAACM,QAAQ,KAAK,IAAAC,kCAAmB,EAACR,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACQ,QAAQ,KAAKN,SAAS,IAAIF,OAAO,CAACQ,QAAQ,KAAK,IAAAC,kCAAmB,EAACV,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACU,QAAQ,KAAKR,SAAS,IAAIF,OAAO,CAACU,QAAQ,KAAK,IAAAC,kCAAmB,EAACZ,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"file":"match-accessibility-state.js","names":["_accessibility","require","matchAccessibilityState","node","matcher","busy","undefined","computeAriaBusy","checked","computeAriaChecked","disabled","computeAriaDisabled","expanded","computeAriaExpanded","selected","computeAriaSelected"],"sources":["../../../src/helpers/matchers/match-accessibility-state.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport {\n computeAriaBusy,\n computeAriaChecked,\n computeAriaDisabled,\n computeAriaExpanded,\n computeAriaSelected,\n} from '../accessibility';\n\n// This type is the same as AccessibilityState from `react-native` package\n// It is re-declared here due to issues with migration from `@types/react-native` to\n// built in `react-native` types.\n// See: https://github.com/callstack/react-native-testing-library/issues/1351\nexport interface AccessibilityStateMatcher {\n disabled?: boolean;\n selected?: boolean;\n checked?: boolean | 'mixed';\n busy?: boolean;\n expanded?: boolean;\n}\n\nexport function matchAccessibilityState(node: HostElement, matcher: AccessibilityStateMatcher) {\n if (matcher.busy !== undefined && matcher.busy !== computeAriaBusy(node)) {\n return false;\n }\n if (matcher.checked !== undefined && matcher.checked !== computeAriaChecked(node)) {\n return false;\n }\n if (matcher.disabled !== undefined && matcher.disabled !== computeAriaDisabled(node)) {\n return false;\n }\n if (matcher.expanded !== undefined && matcher.expanded !== computeAriaExpanded(node)) {\n return false;\n }\n if (matcher.selected !== undefined && matcher.selected !== computeAriaSelected(node)) {\n return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;;AASO,SAASC,uBAAuBA,CAACC,IAAiB,EAAEC,OAAkC,EAAE;EAC7F,IAAIA,OAAO,CAACC,IAAI,KAAKC,SAAS,IAAIF,OAAO,CAACC,IAAI,KAAK,IAAAE,8BAAe,EAACJ,IAAI,CAAC,EAAE;IACxE,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACI,OAAO,KAAKF,SAAS,IAAIF,OAAO,CAACI,OAAO,KAAK,IAAAC,iCAAkB,EAACN,IAAI,CAAC,EAAE;IACjF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACM,QAAQ,KAAKJ,SAAS,IAAIF,OAAO,CAACM,QAAQ,KAAK,IAAAC,kCAAmB,EAACR,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACQ,QAAQ,KAAKN,SAAS,IAAIF,OAAO,CAACQ,QAAQ,KAAK,IAAAC,kCAAmB,EAACV,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACU,QAAQ,KAAKR,SAAS,IAAIF,OAAO,CAACU,QAAQ,KAAK,IAAAC,kCAAmB,EAACZ,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  import { TextMatch } from '../../matches';
3
3
  export interface AccessibilityValueMatcher {
4
4
  min?: number;
@@ -6,4 +6,4 @@ export interface AccessibilityValueMatcher {
6
6
  now?: number;
7
7
  text?: TextMatch;
8
8
  }
9
- export declare function matchAccessibilityValue(node: ReactTestInstance, matcher: AccessibilityValueMatcher): boolean;
9
+ export declare function matchAccessibilityValue(node: HostElement, matcher: AccessibilityValueMatcher): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"match-accessibility-value.js","names":["_accessibility","require","_matchStringProp","matchAccessibilityValue","node","matcher","value","computeAriaValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/match-accessibility-value.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { computeAriaValue } from '../accessibility';\nimport { TextMatch } from '../../matches';\nimport { matchStringProp } from './match-string-prop';\n\nexport interface AccessibilityValueMatcher {\n min?: number;\n max?: number;\n now?: number;\n text?: TextMatch;\n}\n\nexport function matchAccessibilityValue(\n node: ReactTestInstance,\n matcher: AccessibilityValueMatcher,\n): boolean {\n const value = computeAriaValue(node);\n return (\n (matcher.min === undefined || matcher.min === value?.min) &&\n (matcher.max === undefined || matcher.max === value?.max) &&\n (matcher.now === undefined || matcher.now === value?.now) &&\n (matcher.text === undefined || matchStringProp(value?.text, matcher.text))\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AASO,SAASE,uBAAuBA,CACrCC,IAAuB,EACvBC,OAAkC,EACzB;EACT,MAAMC,KAAK,GAAG,IAAAC,+BAAgB,EAACH,IAAI,CAAC;EACpC,OACE,CAACC,OAAO,CAACG,GAAG,KAAKC,SAAS,IAAIJ,OAAO,CAACG,GAAG,KAAKF,KAAK,EAAEE,GAAG,MACvDH,OAAO,CAACK,GAAG,KAAKD,SAAS,IAAIJ,OAAO,CAACK,GAAG,KAAKJ,KAAK,EAAEI,GAAG,CAAC,KACxDL,OAAO,CAACM,GAAG,KAAKF,SAAS,IAAIJ,OAAO,CAACM,GAAG,KAAKL,KAAK,EAAEK,GAAG,CAAC,KACxDN,OAAO,CAACO,IAAI,KAAKH,SAAS,IAAI,IAAAI,gCAAe,EAACP,KAAK,EAAEM,IAAI,EAAEP,OAAO,CAACO,IAAI,CAAC,CAAC;AAE9E","ignoreList":[]}
1
+ {"version":3,"file":"match-accessibility-value.js","names":["_accessibility","require","_matchStringProp","matchAccessibilityValue","node","matcher","value","computeAriaValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/match-accessibility-value.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { computeAriaValue } from '../accessibility';\nimport { TextMatch } from '../../matches';\nimport { matchStringProp } from './match-string-prop';\n\nexport interface AccessibilityValueMatcher {\n min?: number;\n max?: number;\n now?: number;\n text?: TextMatch;\n}\n\nexport function matchAccessibilityValue(\n node: HostElement,\n matcher: AccessibilityValueMatcher,\n): boolean {\n const value = computeAriaValue(node);\n return (\n (matcher.min === undefined || matcher.min === value?.min) &&\n (matcher.max === undefined || matcher.max === value?.max) &&\n (matcher.now === undefined || matcher.now === value?.now) &&\n (matcher.text === undefined || matchStringProp(value?.text, matcher.text))\n );\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,IAAAC,gBAAA,GAAAD,OAAA;AASO,SAASE,uBAAuBA,CACrCC,IAAiB,EACjBC,OAAkC,EACzB;EACT,MAAMC,KAAK,GAAG,IAAAC,+BAAgB,EAACH,IAAI,CAAC;EACpC,OACE,CAACC,OAAO,CAACG,GAAG,KAAKC,SAAS,IAAIJ,OAAO,CAACG,GAAG,KAAKF,KAAK,EAAEE,GAAG,MACvDH,OAAO,CAACK,GAAG,KAAKD,SAAS,IAAIJ,OAAO,CAACK,GAAG,KAAKJ,KAAK,EAAEI,GAAG,CAAC,KACxDL,OAAO,CAACM,GAAG,KAAKF,SAAS,IAAIJ,OAAO,CAACM,GAAG,KAAKL,KAAK,EAAEK,GAAG,CAAC,KACxDN,OAAO,CAACO,IAAI,KAAKH,SAAS,IAAI,IAAAI,gCAAe,EAACP,KAAK,EAAEM,IAAI,EAAEP,OAAO,CAACO,IAAI,CAAC,CAAC;AAE9E","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../../matches';
3
- export declare function matchAccessibilityLabel(element: ReactTestInstance, expectedLabel: TextMatch, options?: TextMatchOptions): boolean;
3
+ export declare function matchAccessibilityLabel(element: HostElement, expectedLabel: TextMatch, options?: TextMatchOptions): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"match-label-text.js","names":["_matches","require","_accessibility","matchAccessibilityLabel","element","expectedLabel","options","matches","computeAriaLabel","normalizer","exact"],"sources":["../../../src/helpers/matchers/match-label-text.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { computeAriaLabel } from '../accessibility';\n\nexport function matchAccessibilityLabel(\n element: ReactTestInstance,\n expectedLabel: TextMatch,\n options?: TextMatchOptions,\n) {\n return matches(expectedLabel, computeAriaLabel(element), options?.normalizer, options?.exact);\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,SAASE,uBAAuBA,CACrCC,OAA0B,EAC1BC,aAAwB,EACxBC,OAA0B,EAC1B;EACA,OAAO,IAAAC,gBAAO,EAACF,aAAa,EAAE,IAAAG,+BAAgB,EAACJ,OAAO,CAAC,EAAEE,OAAO,EAAEG,UAAU,EAAEH,OAAO,EAAEI,KAAK,CAAC;AAC/F","ignoreList":[]}
1
+ {"version":3,"file":"match-label-text.js","names":["_matches","require","_accessibility","matchAccessibilityLabel","element","expectedLabel","options","matches","computeAriaLabel","normalizer","exact"],"sources":["../../../src/helpers/matchers/match-label-text.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { computeAriaLabel } from '../accessibility';\n\nexport function matchAccessibilityLabel(\n element: HostElement,\n expectedLabel: TextMatch,\n options?: TextMatchOptions,\n) {\n return matches(expectedLabel, computeAriaLabel(element), options?.normalizer, options?.exact);\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAEO,SAASE,uBAAuBA,CACrCC,OAAoB,EACpBC,aAAwB,EACxBC,OAA0B,EAC1B;EACA,OAAO,IAAAC,gBAAO,EAACF,aAAa,EAAE,IAAAG,+BAAgB,EAACJ,OAAO,CAAC,EAAEE,OAAO,EAAEG,UAAU,EAAEH,OAAO,EAAEI,KAAK,CAAC;AAC/F","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  import { TextMatch, TextMatchOptions } from '../../matches';
3
3
  /**
4
4
  * Matches the given node's text content against string or regex matcher.
@@ -7,4 +7,4 @@ import { TextMatch, TextMatchOptions } from '../../matches';
7
7
  * @param text - The string or regex to match.
8
8
  * @returns - Whether the node's text content matches the given string or regex.
9
9
  */
10
- export declare function matchTextContent(node: ReactTestInstance, text: TextMatch, options?: TextMatchOptions): boolean;
10
+ export declare function matchTextContent(node: HostElement, text: TextMatch, options?: TextMatchOptions): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"match-text-content.js","names":["_matches","require","_textContent","matchTextContent","node","text","options","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/match-text-content.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { getTextContent } from '../text-content';\n\n/**\n * Matches the given node's text content against string or regex matcher.\n *\n * @param node - Node which text content will be matched\n * @param text - The string or regex to match.\n * @returns - Whether the node's text content matches the given string or regex.\n */\nexport function matchTextContent(\n node: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {},\n) {\n const textContent = getTextContent(node);\n const { exact, normalizer } = options;\n return matches(text, textContent, normalizer, exact);\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAC9BC,IAAuB,EACvBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,MAAMC,WAAW,GAAG,IAAAC,2BAAc,EAACJ,IAAI,CAAC;EACxC,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGJ,OAAO;EACrC,OAAO,IAAAK,gBAAO,EAACN,IAAI,EAAEE,WAAW,EAAEG,UAAU,EAAED,KAAK,CAAC;AACtD","ignoreList":[]}
1
+ {"version":3,"file":"match-text-content.js","names":["_matches","require","_textContent","matchTextContent","node","text","options","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/match-text-content.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { getTextContent } from '../text-content';\n\n/**\n * Matches the given node's text content against string or regex matcher.\n *\n * @param node - Node which text content will be matched\n * @param text - The string or regex to match.\n * @returns - Whether the node's text content matches the given string or regex.\n */\nexport function matchTextContent(\n node: HostElement,\n text: TextMatch,\n options: TextMatchOptions = {},\n) {\n const textContent = getTextContent(node);\n const { exact, normalizer } = options;\n return matches(text, textContent, normalizer, exact);\n}\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAC9BC,IAAiB,EACjBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,MAAMC,WAAW,GAAG,IAAAC,2BAAc,EAACJ,IAAI,CAAC;EACxC,MAAM;IAAEK,KAAK;IAAEC;EAAW,CAAC,GAAGJ,OAAO;EACrC,OAAO,IAAAK,gBAAO,EAACN,IAAI,EAAEE,WAAW,EAAEG,UAAU,EAAED,KAAK,CAAC;AACtD","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import { HostElement } from 'universal-test-renderer';
2
2
  /**
3
3
  * pointerEvents controls whether the View can be the target of touch events.
4
4
  * 'auto': The View and its children can be the target of touch events.
@@ -6,4 +6,4 @@ import { ReactTestInstance } from 'react-test-renderer';
6
6
  * 'box-none': The View is never the target of touch events but its subviews can be
7
7
  * 'box-only': The view can be the target of touch events but its subviews cannot be
8
8
  * see the official react native doc https://reactnative.dev/docs/view#pointerevents */
9
- export declare const isPointerEventEnabled: (element: ReactTestInstance, isParent?: boolean) => boolean;
9
+ export declare const isPointerEventEnabled: (element: HostElement, isParent?: boolean) => boolean;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isPointerEventEnabled = void 0;
7
- var _componentTree = require("./component-tree");
8
7
  /**
9
8
  * pointerEvents controls whether the View can be the target of touch events.
10
9
  * 'auto': The View and its children can be the target of touch events.
@@ -17,7 +16,7 @@ const isPointerEventEnabled = (element, isParent) => {
17
16
  if (element?.props.pointerEvents === 'none' || parentCondition) {
18
17
  return false;
19
18
  }
20
- const hostParent = (0, _componentTree.getHostParent)(element);
19
+ const hostParent = element.parent;
21
20
  if (!hostParent) return true;
22
21
  return isPointerEventEnabled(hostParent, true);
23
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pointer-events.js","names":["_componentTree","require","isPointerEventEnabled","element","isParent","parentCondition","props","pointerEvents","hostParent","getHostParent","exports"],"sources":["../../src/helpers/pointer-events.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getHostParent } from './component-tree';\n\n/**\n * pointerEvents controls whether the View can be the target of touch events.\n * 'auto': The View and its children can be the target of touch events.\n * 'none': The View is never the target of touch events.\n * 'box-none': The View is never the target of touch events but its subviews can be\n * 'box-only': The view can be the target of touch events but its subviews cannot be\n * see the official react native doc https://reactnative.dev/docs/view#pointerevents */\nexport const isPointerEventEnabled = (element: ReactTestInstance, isParent?: boolean): boolean => {\n const parentCondition = isParent\n ? element?.props.pointerEvents === 'box-only'\n : element?.props.pointerEvents === 'box-none';\n\n if (element?.props.pointerEvents === 'none' || parentCondition) {\n return false;\n }\n\n const hostParent = getHostParent(element);\n if (!hostParent) return true;\n\n return isPointerEventEnabled(hostParent, true);\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAGA,CAACC,OAA0B,EAAEC,QAAkB,KAAc;EAChG,MAAMC,eAAe,GAAGD,QAAQ,GAC5BD,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,UAAU,GAC3CJ,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,UAAU;EAE/C,IAAIJ,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,MAAM,IAAIF,eAAe,EAAE;IAC9D,OAAO,KAAK;EACd;EAEA,MAAMG,UAAU,GAAG,IAAAC,4BAAa,EAACN,OAAO,CAAC;EACzC,IAAI,CAACK,UAAU,EAAE,OAAO,IAAI;EAE5B,OAAON,qBAAqB,CAACM,UAAU,EAAE,IAAI,CAAC;AAChD,CAAC;AAACE,OAAA,CAAAR,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"file":"pointer-events.js","names":["isPointerEventEnabled","element","isParent","parentCondition","props","pointerEvents","hostParent","parent","exports"],"sources":["../../src/helpers/pointer-events.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\n\n/**\n * pointerEvents controls whether the View can be the target of touch events.\n * 'auto': The View and its children can be the target of touch events.\n * 'none': The View is never the target of touch events.\n * 'box-none': The View is never the target of touch events but its subviews can be\n * 'box-only': The view can be the target of touch events but its subviews cannot be\n * see the official react native doc https://reactnative.dev/docs/view#pointerevents */\nexport const isPointerEventEnabled = (element: HostElement, isParent?: boolean): boolean => {\n const parentCondition = isParent\n ? element?.props.pointerEvents === 'box-only'\n : element?.props.pointerEvents === 'box-none';\n\n if (element?.props.pointerEvents === 'none' || parentCondition) {\n return false;\n }\n\n const hostParent = element.parent;\n if (!hostParent) return true;\n\n return isPointerEventEnabled(hostParent, true);\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,qBAAqB,GAAGA,CAACC,OAAoB,EAAEC,QAAkB,KAAc;EAC1F,MAAMC,eAAe,GAAGD,QAAQ,GAC5BD,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,UAAU,GAC3CJ,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,UAAU;EAE/C,IAAIJ,OAAO,EAAEG,KAAK,CAACC,aAAa,KAAK,MAAM,IAAIF,eAAe,EAAE;IAC9D,OAAO,KAAK;EACd;EAEA,MAAMG,UAAU,GAAGL,OAAO,CAACM,MAAM;EACjC,IAAI,CAACD,UAAU,EAAE,OAAO,IAAI;EAE5B,OAAON,qBAAqB,CAACM,UAAU,EAAE,IAAI,CAAC;AAChD,CAAC;AAACE,OAAA,CAAAR,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
- export declare function getTextContent(element: ReactTestInstance | string | null): string;
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function getTextContent(element: HostElement | string | null): string;
@@ -1 +1 @@
1
- {"version":3,"file":"text-content.js","names":["getTextContent","element","result","children","forEach","child","push","join"],"sources":["../../src/helpers/text-content.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\n\nexport function getTextContent(element: ReactTestInstance | string | null): string {\n if (!element) {\n return '';\n }\n\n if (typeof element === 'string') {\n return element;\n }\n\n const result: string[] = [];\n element.children?.forEach((child) => {\n result.push(getTextContent(child));\n });\n\n return result.join('');\n}\n"],"mappings":";;;;;;AAEO,SAASA,cAAcA,CAACC,OAA0C,EAAU;EACjF,IAAI,CAACA,OAAO,EAAE;IACZ,OAAO,EAAE;EACX;EAEA,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOA,OAAO;EAChB;EAEA,MAAMC,MAAgB,GAAG,EAAE;EAC3BD,OAAO,CAACE,QAAQ,EAAEC,OAAO,CAAEC,KAAK,IAAK;IACnCH,MAAM,CAACI,IAAI,CAACN,cAAc,CAACK,KAAK,CAAC,CAAC;EACpC,CAAC,CAAC;EAEF,OAAOH,MAAM,CAACK,IAAI,CAAC,EAAE,CAAC;AACxB","ignoreList":[]}
1
+ {"version":3,"file":"text-content.js","names":["getTextContent","element","result","children","forEach","child","push","join"],"sources":["../../src/helpers/text-content.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\n\nexport function getTextContent(element: HostElement | string | null): string {\n if (!element) {\n return '';\n }\n\n if (typeof element === 'string') {\n return element;\n }\n\n const result: string[] = [];\n element.children?.forEach((child) => {\n result.push(getTextContent(child));\n });\n\n return result.join('');\n}\n"],"mappings":";;;;;;AAEO,SAASA,cAAcA,CAACC,OAAoC,EAAU;EAC3E,IAAI,CAACA,OAAO,EAAE;IACZ,OAAO,EAAE;EACX;EAEA,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOA,OAAO;EAChB;EAEA,MAAMC,MAAgB,GAAG,EAAE;EAC3BD,OAAO,CAACE,QAAQ,EAAEC,OAAO,CAAEC,KAAK,IAAK;IACnCH,MAAM,CAACI,IAAI,CAACN,cAAc,CAACK,KAAK,CAAC,CAAC;EACpC,CAAC,CAAC;EAEF,OAAOH,MAAM,CAACK,IAAI,CAAC,EAAE,CAAC;AACxB","ignoreList":[]}
@@ -1,3 +1,3 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- export declare function isEditableTextInput(element: ReactTestInstance): boolean;
3
- export declare function getTextInputValue(element: ReactTestInstance): any;
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function isEditableTextInput(element: HostElement): boolean;
3
+ export declare function getTextInputValue(element: HostElement): any;
@@ -1 +1 @@
1
- {"version":3,"file":"text-input.js","names":["_nativeState","require","_hostComponentNames","isEditableTextInput","element","isHostTextInput","props","editable","getTextInputValue","Error","type","value","nativeState","valueForElement","get","defaultValue"],"sources":["../../src/helpers/text-input.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { nativeState } from '../native-state';\nimport { isHostTextInput } from './host-component-names';\n\nexport function isEditableTextInput(element: ReactTestInstance) {\n return isHostTextInput(element) && element.props.editable !== false;\n}\n\nexport function getTextInputValue(element: ReactTestInstance) {\n if (!isHostTextInput(element)) {\n throw new Error(`Element is not a \"TextInput\", but it has type \"${element.type}\".`);\n }\n\n return (\n element.props.value ??\n nativeState.valueForElement.get(element) ??\n element.props.defaultValue ??\n ''\n );\n}\n"],"mappings":";;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEO,SAASE,mBAAmBA,CAACC,OAA0B,EAAE;EAC9D,OAAO,IAAAC,mCAAe,EAACD,OAAO,CAAC,IAAIA,OAAO,CAACE,KAAK,CAACC,QAAQ,KAAK,KAAK;AACrE;AAEO,SAASC,iBAAiBA,CAACJ,OAA0B,EAAE;EAC5D,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIK,KAAK,CAAC,kDAAkDL,OAAO,CAACM,IAAI,IAAI,CAAC;EACrF;EAEA,OACEN,OAAO,CAACE,KAAK,CAACK,KAAK,IACnBC,wBAAW,CAACC,eAAe,CAACC,GAAG,CAACV,OAAO,CAAC,IACxCA,OAAO,CAACE,KAAK,CAACS,YAAY,IAC1B,EAAE;AAEN","ignoreList":[]}
1
+ {"version":3,"file":"text-input.js","names":["_nativeState","require","_hostComponentNames","isEditableTextInput","element","isHostTextInput","props","editable","getTextInputValue","Error","type","value","nativeState","valueForElement","get","defaultValue"],"sources":["../../src/helpers/text-input.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { nativeState } from '../native-state';\nimport { isHostTextInput } from './host-component-names';\n\nexport function isEditableTextInput(element: HostElement) {\n return isHostTextInput(element) && element.props.editable !== false;\n}\n\nexport function getTextInputValue(element: HostElement) {\n if (!isHostTextInput(element)) {\n throw new Error(`Element is not a \"TextInput\", but it has type \"${element.type}\".`);\n }\n\n return (\n element.props.value ??\n nativeState.valueForElement.get(element) ??\n element.props.defaultValue ??\n ''\n );\n}\n"],"mappings":";;;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AAEO,SAASE,mBAAmBA,CAACC,OAAoB,EAAE;EACxD,OAAO,IAAAC,mCAAe,EAACD,OAAO,CAAC,IAAIA,OAAO,CAACE,KAAK,CAACC,QAAQ,KAAK,KAAK;AACrE;AAEO,SAASC,iBAAiBA,CAACJ,OAAoB,EAAE;EACtD,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIK,KAAK,CAAC,kDAAkDL,OAAO,CAACM,IAAI,IAAI,CAAC;EACrF;EAEA,OACEN,OAAO,CAACE,KAAK,CAACK,KAAK,IACnBC,wBAAW,CAACC,eAAe,CAACC,GAAG,CAACV,OAAO,CAAC,IACxCA,OAAO,CAACE,KAAK,CAACS,YAAY,IAC1B,EAAE;AAEN","ignoreList":[]}
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.
3
+ * See: https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/src/pure.js#L37
3
4
  *
4
5
  * @param callback Async callback to run
5
6
  * @returns Result of the callback
@@ -10,6 +10,7 @@ var _flushMicroTasks = require("../flush-micro-tasks");
10
10
 
11
11
  /**
12
12
  * Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.
13
+ * See: https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/src/pure.js#L37
13
14
  *
14
15
  * @param callback Async callback to run
15
16
  * @returns Result of the callback
@@ -1 +1 @@
1
- {"version":3,"file":"wrap-async.js","names":["_act","require","_flushMicroTasks","wrapAsync","callback","previousActEnvironment","getIsReactActEnvironment","setReactActEnvironment","result","flushMicroTasks"],"sources":["../../src/helpers/wrap-async.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport { getIsReactActEnvironment, setReactActEnvironment } from '../act';\nimport { flushMicroTasks } from '../flush-micro-tasks';\n\n/**\n * Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.\n *\n * @param callback Async callback to run\n * @returns Result of the callback\n */\nexport async function wrapAsync<Result>(callback: () => Promise<Result>): Promise<Result> {\n const previousActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(false);\n\n try {\n const result = await callback();\n // Flush the microtask queue before restoring the `act` environment\n await flushMicroTasks();\n return result;\n } finally {\n setReactActEnvironment(previousActEnvironment);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAHA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,SAASA,CAASC,QAA+B,EAAmB;EACxF,MAAMC,sBAAsB,GAAG,IAAAC,6BAAwB,EAAC,CAAC;EACzD,IAAAC,2BAAsB,EAAC,KAAK,CAAC;EAE7B,IAAI;IACF,MAAMC,MAAM,GAAG,MAAMJ,QAAQ,CAAC,CAAC;IAC/B;IACA,MAAM,IAAAK,gCAAe,EAAC,CAAC;IACvB,OAAOD,MAAM;EACf,CAAC,SAAS;IACR,IAAAD,2BAAsB,EAACF,sBAAsB,CAAC;EAChD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"wrap-async.js","names":["_act","require","_flushMicroTasks","wrapAsync","callback","previousActEnvironment","getIsReactActEnvironment","setReactActEnvironment","result","flushMicroTasks"],"sources":["../../src/helpers/wrap-async.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport { getIsReactActEnvironment, setReactActEnvironment } from '../act';\nimport { flushMicroTasks } from '../flush-micro-tasks';\n\n/**\n * Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.\n * See: https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/src/pure.js#L37\n *\n * @param callback Async callback to run\n * @returns Result of the callback\n */\nexport async function wrapAsync<Result>(callback: () => Promise<Result>): Promise<Result> {\n const previousActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(false);\n\n try {\n const result = await callback();\n // Flush the microtask queue before restoring the `act` environment\n await flushMicroTasks();\n return result;\n } finally {\n setReactActEnvironment(previousActEnvironment);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAHA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,SAASA,CAASC,QAA+B,EAAmB;EACxF,MAAMC,sBAAsB,GAAG,IAAAC,6BAAwB,EAAC,CAAC;EACzD,IAAAC,2BAAsB,EAAC,KAAK,CAAC;EAE7B,IAAI;IACF,MAAMC,MAAM,GAAG,MAAMJ,QAAQ,CAAC,CAAC;IAC/B;IACA,MAAM,IAAAK,gCAAe,EAAC,CAAC;IACvB,OAAOD,MAAM;EACf,CAAC,SAAS;IACR,IAAAD,2BAAsB,EAACF,sBAAsB,CAAC;EAChD;AACF","ignoreList":[]}
package/build/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export { HostElement } from 'universal-test-renderer';
1
2
  import './matchers/extend-expect';
2
3
  export * from './pure';
@@ -314,7 +314,6 @@ declare module '@testing-library/react-native' {
314
314
  declare interface RenderOptions {
315
315
  wrapper?: React.ComponentType<any>;
316
316
  createNodeMock?: (element: React.Element<any>) => any;
317
- unstable_validateStringsRenderedWithinText?: boolean;
318
317
  unstable_isConcurrent?: boolean;
319
318
  unstable_strictMode?: boolean;
320
319
  unstable_concurrentUpdatesByDefault?: boolean;
package/build/index.js CHANGED
@@ -3,9 +3,20 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ HostElement: true
8
+ };
9
+ Object.defineProperty(exports, "HostElement", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _universalTestRenderer.HostElement;
13
+ }
14
+ });
15
+ var _universalTestRenderer = require("universal-test-renderer");
6
16
  var _pure = require("./pure");
7
17
  Object.keys(_pure).forEach(function (key) {
8
18
  if (key === "default" || key === "__esModule") return;
19
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
9
20
  if (key in exports && exports[key] === _pure[key]) return;
10
21
  Object.defineProperty(exports, key, {
11
22
  enumerable: true,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_pure","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_flushMicroTasks","_act","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import { cleanup } from './pure';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\nimport './matchers/extend-expect';\n\nif (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {\n // If we're running in a test runner that supports afterEach\n // then we'll automatically run cleanup afterEach test\n // this ensures that tests run in isolation from each other\n // if you don't like this then either import the `pure` module\n // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.\n if (typeof afterEach === 'function') {\n // eslint-disable-next-line no-undef\n afterEach(async () => {\n await flushMicroTasks();\n cleanup();\n });\n }\n\n if (typeof beforeAll === 'function' && typeof afterAll === 'function') {\n // This matches the behavior of React < 18.\n let previousIsReactActEnvironment = getIsReactActEnvironment();\n beforeAll(() => {\n previousIsReactActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(true);\n });\n\n afterAll(() => {\n setReactActEnvironment(previousIsReactActEnvironment);\n });\n }\n}\n\nexport * from './pure';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAiCAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAhCA,IAAAK,gBAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AACAA,OAAA;AAEA,IAAI,CAACW,OAAO,EAAEC,GAAG,EAAEC,sBAAsB,EAAE;EACzC;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnC;IACAA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,EAAC,CAAC;MACvB,IAAAC,aAAO,EAAC,CAAC;IACX,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOC,SAAS,KAAK,UAAU,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IACrE;IACA,IAAIC,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;IAC9DH,SAAS,CAAC,MAAM;MACdE,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;MAC1D,IAAAC,2BAAsB,EAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEFH,QAAQ,CAAC,MAAM;MACb,IAAAG,2BAAsB,EAACF,6BAA6B,CAAC;IACvD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_universalTestRenderer","require","_pure","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_flushMicroTasks","_act","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["export { HostElement } from 'universal-test-renderer';\n\nimport { cleanup } from './pure';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\nimport './matchers/extend-expect';\n\nif (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {\n // If we're running in a test runner that supports afterEach\n // then we'll automatically run cleanup afterEach test\n // this ensures that tests run in isolation from each other\n // if you don't like this then either import the `pure` module\n // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.\n if (typeof afterEach === 'function') {\n // eslint-disable-next-line no-undef\n afterEach(async () => {\n await flushMicroTasks();\n cleanup();\n });\n }\n\n if (typeof beforeAll === 'function' && typeof afterAll === 'function') {\n // This matches the behavior of React < 18.\n let previousIsReactActEnvironment = getIsReactActEnvironment();\n beforeAll(() => {\n previousIsReactActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(true);\n });\n\n afterAll(() => {\n setReactActEnvironment(previousIsReactActEnvironment);\n });\n }\n}\n\nexport * from './pure';\n"],"mappings":";;;;;;;;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,KAAA,GAAAD,OAAA;AAiCAE,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAhCA,IAAAS,gBAAA,GAAAd,OAAA;AACA,IAAAe,IAAA,GAAAf,OAAA;AACAA,OAAA;AAEA,IAAI,CAACgB,OAAO,EAAEC,GAAG,EAAEC,sBAAsB,EAAE;EACzC;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnC;IACAA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,EAAC,CAAC;MACvB,IAAAC,aAAO,EAAC,CAAC;IACX,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOC,SAAS,KAAK,UAAU,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IACrE;IACA,IAAIC,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;IAC9DH,SAAS,CAAC,MAAM;MACdE,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;MAC1D,IAAAC,2BAAsB,EAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEFH,QAAQ,CAAC,MAAM;MACb,IAAAG,2BAAsB,EAACF,6BAA6B,CAAC;IACvD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeBusy(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeBusy(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeBusy","element","checkHostElement","pass","computeAriaBusy","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-busy.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { computeAriaBusy } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: computeAriaBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,QAAQA,CAA4BC,OAA0B,EAAE;EAC9E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,8BAAe,EAACH,OAAO,CAAC;IAC9BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;MAClF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,OAAO,EACtD,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeBusy","element","checkHostElement","pass","computeAriaBusy","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-busy.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport { computeAriaBusy } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: computeAriaBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,QAAQA,CAA4BC,OAAoB,EAAE;EACxE,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,8BAAe,EAACH,OAAO,CAAC;IAC9BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;MAClF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,OAAO,EACtD,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeChecked(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeChecked(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_hostComponentNames","_utils","toBeChecked","element","checkHostElement","isHostSwitch","isSupportedAccessibilityElement","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","formatElement","join","isAccessibilityElement","role","getRole","rolesSupportingCheckedState"],"sources":["../../src/matchers/to-be-checked.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport {\n computeAriaChecked,\n getRole,\n isAccessibilityElement,\n rolesSupportingCheckedState,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostSwitch } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeChecked, this);\n\n if (!isHostSwitch(element) && !isSupportedAccessibilityElement(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on host \"Switch\" elements or accessibility elements with \"checkbox\", \"radio\" or \"switch\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isSupportedAccessibilityElement(element: ReactTestInstance) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getRole(element);\n return rolesSupportingCheckedState[role];\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,WAAWA,CAA4BC,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAAC,IAAAG,gCAAY,EAACF,OAAO,CAAC,IAAI,CAACG,+BAA+B,CAACH,OAAO,CAAC,EAAE;IACvE,MAAM,IAAII,sBAAc,CACtB,yHAAyH,EACzHL,WACF,CAAC;EACH;EAEA,OAAO;IACLM,IAAI,EAAE,IAAAC,iCAAkB,EAACN,OAAO,CAAC,KAAK,IAAI;IAC1CO,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACX,OAAO,CAAC,CACvB,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAAST,+BAA+BA,CAACH,OAA0B,EAAE;EACnE,IAAI,CAAC,IAAAa,qCAAsB,EAACb,OAAO,CAAC,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,MAAMc,IAAI,GAAG,IAAAC,sBAAO,EAACf,OAAO,CAAC;EAC7B,OAAOgB,0CAA2B,CAACF,IAAI,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_hostComponentNames","_utils","toBeChecked","element","checkHostElement","isHostSwitch","isSupportedAccessibilityElement","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","formatElement","join","isAccessibilityElement","role","getRole","rolesSupportingCheckedState"],"sources":["../../src/matchers/to-be-checked.ts"],"sourcesContent":["import { matcherHint } from 'jest-matcher-utils';\nimport { HostElement } from 'universal-test-renderer';\nimport {\n computeAriaChecked,\n getRole,\n isAccessibilityElement,\n rolesSupportingCheckedState,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostSwitch } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: HostElement) {\n checkHostElement(element, toBeChecked, this);\n\n if (!isHostSwitch(element) && !isSupportedAccessibilityElement(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on host \"Switch\" elements or accessibility elements with \"checkbox\", \"radio\" or \"switch\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isSupportedAccessibilityElement(element: HostElement) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getRole(element);\n return rolesSupportingCheckedState[role];\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,cAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,WAAWA,CAA4BC,OAAoB,EAAE;EAC3E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAAC,IAAAG,gCAAY,EAACF,OAAO,CAAC,IAAI,CAACG,+BAA+B,CAACH,OAAO,CAAC,EAAE;IACvE,MAAM,IAAII,sBAAc,CACtB,yHAAyH,EACzHL,WACF,CAAC;EACH;EAEA,OAAO;IACLM,IAAI,EAAE,IAAAC,iCAAkB,EAACN,OAAO,CAAC,KAAK,IAAI;IAC1CO,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACX,OAAO,CAAC,CACvB,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAAST,+BAA+BA,CAACH,OAAoB,EAAE;EAC7D,IAAI,CAAC,IAAAa,qCAAsB,EAACb,OAAO,CAAC,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,MAAMc,IAAI,GAAG,IAAAC,sBAAO,EAACf,OAAO,CAAC;EAC7B,OAAOgB,0CAA2B,CAACF,IAAI,CAAC;AAC1C","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import type { ReactTestInstance } from 'react-test-renderer';
2
- export declare function toBeDisabled(this: jest.MatcherContext, element: ReactTestInstance): {
1
+ import { HostElement } from 'universal-test-renderer';
2
+ export declare function toBeDisabled(this: jest.MatcherContext, element: HostElement): {
3
3
  pass: boolean;
4
4
  message: () => string;
5
5
  };
6
- export declare function toBeEnabled(this: jest.MatcherContext, element: ReactTestInstance): {
6
+ export declare function toBeEnabled(this: jest.MatcherContext, element: HostElement): {
7
7
  pass: boolean;
8
8
  message: () => string;
9
9
  };