@testing-library/react-native 14.0.0-alpha.1 → 14.0.0-alpha.3

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 (126) hide show
  1. package/README.md +7 -11
  2. package/build/act.d.ts +2 -4
  3. package/build/act.js +4 -5
  4. package/build/act.js.map +1 -1
  5. package/build/cleanup.d.ts +3 -1
  6. package/build/cleanup.js +8 -0
  7. package/build/cleanup.js.map +1 -1
  8. package/build/event-handler.d.ts +2 -2
  9. package/build/event-handler.js +10 -10
  10. package/build/event-handler.js.map +1 -1
  11. package/build/fire-event.d.ts +8 -1
  12. package/build/fire-event.js +44 -28
  13. package/build/fire-event.js.map +1 -1
  14. package/build/helpers/accessibility.js +5 -2
  15. package/build/helpers/accessibility.js.map +1 -1
  16. package/build/helpers/component-tree.d.ts +8 -8
  17. package/build/helpers/component-tree.js +19 -16
  18. package/build/helpers/component-tree.js.map +1 -1
  19. package/build/helpers/debug.d.ts +1 -1
  20. package/build/helpers/debug.js +6 -7
  21. package/build/helpers/debug.js.map +1 -1
  22. package/build/helpers/find-all.js +7 -27
  23. package/build/helpers/find-all.js.map +1 -1
  24. package/build/helpers/format-element.d.ts +3 -3
  25. package/build/helpers/format-element.js +9 -9
  26. package/build/helpers/format-element.js.map +1 -1
  27. package/build/helpers/host-component-names.d.ts +0 -1
  28. package/build/helpers/host-component-names.js +7 -9
  29. package/build/helpers/host-component-names.js.map +1 -1
  30. package/build/helpers/logger.d.ts +22 -0
  31. package/build/helpers/logger.js +13 -8
  32. package/build/helpers/logger.js.map +1 -1
  33. package/build/helpers/pointer-events.js +9 -5
  34. package/build/helpers/pointer-events.js.map +1 -1
  35. package/build/helpers/wrap-async.d.ts +0 -1
  36. package/build/helpers/wrap-async.js +0 -1
  37. package/build/helpers/wrap-async.js.map +1 -1
  38. package/build/index.d.ts +0 -1
  39. package/build/index.flow.js +5 -4
  40. package/build/index.js +1 -12
  41. package/build/index.js.map +1 -1
  42. package/build/matchers/to-be-empty-element.js +6 -3
  43. package/build/matchers/to-be-empty-element.js.map +1 -1
  44. package/build/matchers/to-be-visible.js +3 -3
  45. package/build/matchers/to-be-visible.js.map +1 -1
  46. package/build/matchers/to-contain-element.js +1 -2
  47. package/build/matchers/to-contain-element.js.map +1 -1
  48. package/build/matchers/to-have-style.js +1 -1
  49. package/build/matchers/to-have-style.js.map +1 -1
  50. package/build/matchers/utils.js +3 -2
  51. package/build/matchers/utils.js.map +1 -1
  52. package/build/pure.d.ts +7 -5
  53. package/build/pure.js +30 -4
  54. package/build/pure.js.map +1 -1
  55. package/build/queries/display-value.d.ts +1 -1
  56. package/build/queries/display-value.js +9 -9
  57. package/build/queries/display-value.js.map +1 -1
  58. package/build/queries/hint-text.d.ts +1 -1
  59. package/build/queries/hint-text.js +9 -9
  60. package/build/queries/hint-text.js.map +1 -1
  61. package/build/queries/label-text.d.ts +1 -1
  62. package/build/queries/label-text.js +9 -9
  63. package/build/queries/label-text.js.map +1 -1
  64. package/build/queries/make-queries.d.ts +2 -2
  65. package/build/queries/make-queries.js +11 -11
  66. package/build/queries/make-queries.js.map +1 -1
  67. package/build/queries/placeholder-text.d.ts +1 -1
  68. package/build/queries/placeholder-text.js +9 -9
  69. package/build/queries/placeholder-text.js.map +1 -1
  70. package/build/queries/role.d.ts +2 -2
  71. package/build/queries/role.js +16 -9
  72. package/build/queries/role.js.map +1 -1
  73. package/build/queries/test-id.d.ts +1 -1
  74. package/build/queries/test-id.js +9 -9
  75. package/build/queries/test-id.js.map +1 -1
  76. package/build/queries/text.d.ts +1 -1
  77. package/build/queries/text.js +9 -9
  78. package/build/queries/text.js.map +1 -1
  79. package/build/react-versions.js +1 -2
  80. package/build/react-versions.js.map +1 -1
  81. package/build/render-act.d.ts +3 -0
  82. package/build/render-act.js +29 -0
  83. package/build/render-act.js.map +1 -0
  84. package/build/render-async.d.ts +83 -0
  85. package/build/render-async.js +96 -0
  86. package/build/render-async.js.map +1 -0
  87. package/build/render-hook.d.ts +9 -7
  88. package/build/render-hook.js +44 -14
  89. package/build/render-hook.js.map +1 -1
  90. package/build/render.d.ts +87 -18
  91. package/build/render.js +54 -27
  92. package/build/render.js.map +1 -1
  93. package/build/screen.js +7 -7
  94. package/build/screen.js.map +1 -1
  95. package/build/test-utils/console.d.ts +1 -0
  96. package/build/test-utils/console.js +17 -0
  97. package/build/test-utils/console.js.map +1 -0
  98. package/build/test-utils/json.d.ts +6 -0
  99. package/build/test-utils/json.js +33 -0
  100. package/build/test-utils/json.js.map +1 -0
  101. package/build/tsconfig.release.tsbuildinfo +1 -1
  102. package/build/types.d.ts +4 -0
  103. package/build/types.js.map +1 -1
  104. package/build/user-event/clear.js +4 -4
  105. package/build/user-event/clear.js.map +1 -1
  106. package/build/user-event/paste.js +8 -8
  107. package/build/user-event/paste.js.map +1 -1
  108. package/build/user-event/press/press.js +17 -10
  109. package/build/user-event/press/press.js.map +1 -1
  110. package/build/user-event/scroll/scroll-to.js +7 -7
  111. package/build/user-event/scroll/scroll-to.js.map +1 -1
  112. package/build/user-event/type/type.js +11 -11
  113. package/build/user-event/type/type.js.map +1 -1
  114. package/build/user-event/utils/dispatch-event.d.ts +1 -1
  115. package/build/user-event/utils/dispatch-event.js +4 -4
  116. package/build/user-event/utils/dispatch-event.js.map +1 -1
  117. package/build/wait-for.js +3 -1
  118. package/build/wait-for.js.map +1 -1
  119. package/build/within.d.ts +19 -19
  120. package/build/within.js +8 -8
  121. package/build/within.js.map +1 -1
  122. package/package.json +37 -35
  123. package/typings/index.flow.js +5 -4
  124. package/build/test-utils/index.d.ts +0 -1
  125. package/build/test-utils/index.js +0 -17
  126. package/build/test-utils/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"component-tree.js","names":["_universalTestRenderer","require","_screen","isValidElement","element","type","CONTAINER_TYPE","isElementMounted","getContainerElement","screen","container","current","parent","getHostSiblings","hostParent","children","filter","sibling"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\nimport { CONTAINER_TYPE } from 'universal-test-renderer';\n\nimport { screen } from '../screen';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isValidElement(element?: HostElement | null): element is HostElement {\n return typeof element?.type === 'string' && element.type !== CONTAINER_TYPE;\n}\n\nexport function isElementMounted(element: HostElement) {\n return getContainerElement(element) === screen.container;\n}\n\n/**\n * Returns the unsafe root element of the tree (probably composite).\n *\n * @param element The element start traversing from.\n * @returns The root element of the tree (host or composite).\n */\nexport function getContainerElement(element: HostElement) {\n let current: HostElement | null = element;\n while (current?.parent) {\n current = current.parent;\n }\n\n return current;\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(element: HostElement | null): HostElement[] {\n const hostParent = element?.parent ?? null;\n return (\n hostParent?.children.filter(\n (sibling): sibling is HostElement => typeof sibling === 'object' && sibling !== element,\n ) ?? []\n );\n}\n"],"mappings":";;;;;;;;;AACA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAACC,OAA4B,EAA0B;EACnF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAID,OAAO,CAACC,IAAI,KAAKC,qCAAc;AAC7E;AAEO,SAASC,gBAAgBA,CAACH,OAAoB,EAAE;EACrD,OAAOI,mBAAmB,CAACJ,OAAO,CAAC,KAAKK,cAAM,CAACC,SAAS;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASF,mBAAmBA,CAACJ,OAAoB,EAAE;EACxD,IAAIO,OAA2B,GAAGP,OAAO;EACzC,OAAOO,OAAO,EAAEC,MAAM,EAAE;IACtBD,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAACT,OAA2B,EAAiB;EAC1E,MAAMU,UAAU,GAAGV,OAAO,EAAEQ,MAAM,IAAI,IAAI;EAC1C,OACEE,UAAU,EAAEC,QAAQ,CAACC,MAAM,CACxBC,OAAO,IAA6B,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAKb,OAClF,CAAC,IAAI,EAAE;AAEX","ignoreList":[]}
1
+ {"version":3,"file":"component-tree.js","names":["_screen","require","isHostElement","element","type","isElementMounted","getContainerElement","screen","container","getHostSiblings","parent","children","filter","sibling","current"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import type { HostElement, HostNode } from 'universal-test-renderer';\n\nimport { screen } from '../screen';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isHostElement(element?: HostNode | null): element is HostElement {\n return typeof element !== 'string' && typeof element?.type === 'string';\n}\n\nexport function isElementMounted(element: HostElement) {\n return getContainerElement(element) === screen.container;\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(element: HostElement): HostElement[] {\n // Should not happen\n const parent = element.parent;\n if (!parent) {\n return [];\n }\n\n return parent.children.filter(\n (sibling) => typeof sibling !== 'string' && sibling !== element,\n ) as HostElement[];\n}\n\n/**\n * Returns the containerelement of the tree.\n *\n * @param element The element start traversing from.\n * @returns The container element of the tree.\n */\nexport function getContainerElement(element: HostElement) {\n let current = element;\n while (current.parent) {\n current = current.parent;\n }\n\n return current;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAACC,OAAyB,EAA0B;EAC/E,OAAO,OAAOA,OAAO,KAAK,QAAQ,IAAI,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ;AACzE;AAEO,SAASC,gBAAgBA,CAACF,OAAoB,EAAE;EACrD,OAAOG,mBAAmB,CAACH,OAAO,CAAC,KAAKI,cAAM,CAACC,SAAS;AAC1D;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACN,OAAoB,EAAiB;EACnE;EACA,MAAMO,MAAM,GAAGP,OAAO,CAACO,MAAM;EAC7B,IAAI,CAACA,MAAM,EAAE;IACX,OAAO,EAAE;EACX;EAEA,OAAOA,MAAM,CAACC,QAAQ,CAACC,MAAM,CAC1BC,OAAO,IAAK,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAKV,OAC1D,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,mBAAmBA,CAACH,OAAoB,EAAE;EACxD,IAAIW,OAAO,GAAGX,OAAO;EACrB,OAAOW,OAAO,CAACJ,MAAM,EAAE;IACrBI,OAAO,GAAGA,OAAO,CAACJ,MAAM;EAC1B;EAEA,OAAOI,OAAO;AAChB","ignoreList":[]}
@@ -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: JsonNode | JsonNode[], options?: DebugOptions): void;
9
+ export declare function debug(node: JsonNode | JsonNode[], { message, ...formatOptions }?: DebugOptions): void;
@@ -9,15 +9,14 @@ var _logger = require("./logger");
9
9
  /**
10
10
  * Log pretty-printed deep test component instance
11
11
  */
12
- function debug(instance, options) {
13
- const message = options?.message;
14
- const formatOptions = {
15
- mapProps: options?.mapProps
16
- };
12
+ function debug(node, {
13
+ message,
14
+ ...formatOptions
15
+ } = {}) {
17
16
  if (message) {
18
- _logger.logger.info(`${message}\n\n`, (0, _formatElement.formatJson)(instance, formatOptions));
17
+ _logger.logger.info(`${message}\n\n`, (0, _formatElement.formatJson)(node, formatOptions));
19
18
  } else {
20
- _logger.logger.info((0, _formatElement.formatJson)(instance, formatOptions));
19
+ _logger.logger.info((0, _formatElement.formatJson)(node, formatOptions));
21
20
  }
22
21
  }
23
22
  //# sourceMappingURL=debug.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","names":["_formatElement","require","_logger","debug","instance","options","message","formatOptions","mapProps","logger","info","formatJson"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type { JsonNode } from 'universal-test-renderer';\n\nimport type { FormatElementOptions } from './format-element';\nimport { formatJson } from './format-element';\nimport { logger } from './logger';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatElementOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport function debug(instance: JsonNode | JsonNode[], options?: DebugOptions) {\n const message = options?.message;\n const formatOptions = { mapProps: options?.mapProps };\n\n if (message) {\n logger.info(`${message}\\n\\n`, formatJson(instance, formatOptions));\n } else {\n logger.info(formatJson(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACO,SAASE,KAAKA,CAACC,QAA+B,EAAEC,OAAsB,EAAE;EAC7E,MAAMC,OAAO,GAAGD,OAAO,EAAEC,OAAO;EAChC,MAAMC,aAAa,GAAG;IAAEC,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC;EAErD,IAAIF,OAAO,EAAE;IACXG,cAAM,CAACC,IAAI,CAAC,GAAGJ,OAAO,MAAM,EAAE,IAAAK,yBAAU,EAACP,QAAQ,EAAEG,aAAa,CAAC,CAAC;EACpE,CAAC,MAAM;IACLE,cAAM,CAACC,IAAI,CAAC,IAAAC,yBAAU,EAACP,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAClD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"debug.js","names":["_formatElement","require","_logger","debug","node","message","formatOptions","logger","info","formatJson"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type { JsonNode } from 'universal-test-renderer';\n\nimport type { FormatElementOptions } from './format-element';\nimport { formatJson } from './format-element';\nimport { logger } from './logger';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatElementOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport function debug(\n node: JsonNode | JsonNode[],\n { message, ...formatOptions }: DebugOptions = {},\n) {\n if (message) {\n logger.info(`${message}\\n\\n`, formatJson(node, formatOptions));\n } else {\n logger.info(formatJson(node, formatOptions));\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACO,SAASE,KAAKA,CACnBC,IAA2B,EAC3B;EAAEC,OAAO;EAAE,GAAGC;AAA4B,CAAC,GAAG,CAAC,CAAC,EAChD;EACA,IAAID,OAAO,EAAE;IACXE,cAAM,CAACC,IAAI,CAAC,GAAGH,OAAO,MAAM,EAAE,IAAAI,yBAAU,EAACL,IAAI,EAAEE,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACLC,cAAM,CAACC,IAAI,CAAC,IAAAC,yBAAU,EAACL,IAAI,EAAEE,aAAa,CAAC,CAAC;EAC9C;AACF","ignoreList":[]}
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.findAll = findAll;
7
7
  var _config = require("../config");
8
8
  var _accessibility = require("./accessibility");
9
- var _componentTree = require("./component-tree");
10
- function findAll(root, predicate, options) {
11
- const results = findAllInternal(root, predicate, options);
9
+ function findAll(root, predicate, options = {}) {
10
+ const {
11
+ matchDeepestOnly
12
+ } = options;
13
+ const results = root.queryAll(predicate, {
14
+ matchDeepestOnly
15
+ });
12
16
  const includeHiddenElements = options?.includeHiddenElements ?? options?.hidden ?? (0, _config.getConfig)()?.defaultIncludeHiddenElements;
13
17
  if (includeHiddenElements) {
14
18
  return results;
@@ -18,28 +22,4 @@ function findAll(root, predicate, options) {
18
22
  cache
19
23
  }));
20
24
  }
21
-
22
- // Extracted from React Test Renderer
23
- // src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402
24
- function findAllInternal(node, predicate, options, indent = '') {
25
- const results = [];
26
-
27
- // Match descendants first but do not add them to results yet.
28
- const matchingDescendants = [];
29
- node.children.forEach(child => {
30
- if (typeof child === 'string') {
31
- return;
32
- }
33
- matchingDescendants.push(...findAllInternal(child, predicate, options, indent + ' '));
34
- });
35
- if (
36
- // When matchDeepestOnly = true: add current element only if no descendants match
37
- (!options?.matchDeepestOnly || matchingDescendants.length === 0) && (0, _componentTree.isValidElement)(node) && predicate(node)) {
38
- results.push(node);
39
- }
40
-
41
- // Add matching descendants after element to preserve original tree walk order.
42
- results.push(...matchingDescendants);
43
- return results;
44
- }
45
25
  //# sourceMappingURL=find-all.js.map
@@ -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","node","indent","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length","isValidElement"],"sources":["../../src/helpers/find-all.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\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":";;;;;;AAEA,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
+ {"version":3,"file":"find-all.js","names":["_config","require","_accessibility","findAll","root","predicate","options","matchDeepestOnly","results","queryAll","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility"],"sources":["../../src/helpers/find-all.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessibility';\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 { matchDeepestOnly } = options;\n const results = root.queryAll(predicate, { matchDeepestOnly });\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"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAaO,SAASE,OAAOA,CACrBC,IAAiB,EACjBC,SAA4C,EAC5CC,OAAuB,GAAG,CAAC,CAAC,EACb;EACf,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EACpC,MAAME,OAAO,GAAGJ,IAAI,CAACK,QAAQ,CAACJ,SAAS,EAAE;IAAEE;EAAiB,CAAC,CAAC;EAE9D,MAAMG,qBAAqB,GACzBJ,OAAO,EAAEI,qBAAqB,IAAIJ,OAAO,EAAEK,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","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { HostNode, JsonNode } from 'universal-test-renderer';
1
+ import type { HostElement, JsonNode } from 'universal-test-renderer';
2
2
  import type { MapPropsFunction } from './map-props';
3
3
  export type FormatElementOptions = {
4
4
  /** Minimize used space. */
@@ -13,6 +13,6 @@ export type FormatElementOptions = {
13
13
  *
14
14
  * @param element Element to format.
15
15
  */
16
- export declare function formatElement(element: HostNode | null, { compact, highlight, mapProps }?: FormatElementOptions): string;
17
- export declare function formatElementList(elements: HostNode[], options?: FormatElementOptions): string;
16
+ export declare function formatElement(element: HostElement | null, { compact, highlight, mapProps }?: FormatElementOptions): string;
17
+ export declare function formatElementList(elements: HostElement[], options?: FormatElementOptions): string;
18
18
  export declare function formatJson(json: JsonNode | JsonNode[], { compact, highlight, mapProps }?: FormatElementOptions): string;
@@ -8,8 +8,7 @@ exports.formatElementList = formatElementList;
8
8
  exports.formatJson = formatJson;
9
9
  var _prettyFormat = _interopRequireWildcard(require("pretty-format"));
10
10
  var _mapProps = require("./map-props");
11
- 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); }
12
- 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 && {}.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; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
12
  /***
14
13
  * Format given element as a pretty-printed string.
15
14
  *
@@ -23,21 +22,22 @@ function formatElement(element, {
23
22
  if (element == null) {
24
23
  return '(null)';
25
24
  }
26
- if (typeof element === 'string') {
27
- return element;
28
- }
29
- const childrenToDisplay = element.children.filter(child => typeof child === 'string');
25
+ const {
26
+ children,
27
+ ...props
28
+ } = element.props;
29
+ const childrenToDisplay = typeof children === 'string' ? [children] : undefined;
30
30
  return (0, _prettyFormat.default)({
31
31
  // This prop is needed persuade the prettyFormat that the element is
32
- // a ReactTestRendererJSON instance, so it is formatted as JSX.
32
+ // a JsonNode instance, so it is formatted as JSX.
33
33
  $$typeof: Symbol.for('react.test.json'),
34
34
  type: `${element.type}`,
35
- props: mapProps ? mapProps(element.props) : element.props,
35
+ props: mapProps ? mapProps(props) : props,
36
36
  children: childrenToDisplay
37
37
  },
38
38
  // See: https://www.npmjs.com/package/pretty-format#usage-with-options
39
39
  {
40
- plugins: [_prettyFormat.plugins.ReactTestComponent],
40
+ plugins: [_prettyFormat.plugins.ReactTestComponent, _prettyFormat.plugins.ReactElement],
41
41
  printFunctionName: false,
42
42
  printBasicPrototype: false,
43
43
  highlight: highlight,
@@ -1 +1 @@
1
- {"version":3,"file":"format-element.js","names":["_prettyFormat","_interopRequireWildcard","require","_mapProps","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","formatElement","element","compact","highlight","mapProps","defaultMapProps","childrenToDisplay","children","filter","child","prettyFormat","$$typeof","Symbol","for","type","props","plugins","ReactTestComponent","printFunctionName","printBasicPrototype","min","formatElementList","elements","options","length","map","join","formatJson","json","getElementJsonPlugin","ReactElement","test","val","serialize","config","indentation","depth","refs","printer","newVal"],"sources":["../../src/helpers/format-element.ts"],"sourcesContent":["import type { NewPlugin } from 'pretty-format';\nimport prettyFormat, { plugins } from 'pretty-format';\nimport type { HostNode, JsonNode } from 'universal-test-renderer';\n\nimport type { MapPropsFunction } from './map-props';\nimport { defaultMapProps } from './map-props';\n\nexport type FormatElementOptions = {\n /** Minimize used space. */\n compact?: boolean;\n\n /** Highlight the output. */\n highlight?: boolean;\n\n /** Filter or map props to display. */\n mapProps?: MapPropsFunction | null;\n};\n\n/***\n * Format given element as a pretty-printed string.\n *\n * @param element Element to format.\n */\nexport function formatElement(\n element: HostNode | null,\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n if (element == null) {\n return '(null)';\n }\n\n if (typeof element === 'string') {\n return element;\n }\n\n const childrenToDisplay = element.children.filter((child) => typeof child === 'string');\n\n return 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: mapProps ? mapProps(element.props) : element.props,\n children: childrenToDisplay,\n },\n // See: https://www.npmjs.com/package/pretty-format#usage-with-options\n {\n plugins: [plugins.ReactTestComponent],\n printFunctionName: false,\n printBasicPrototype: false,\n highlight: highlight,\n min: compact,\n },\n );\n}\n\nexport function formatElementList(elements: HostNode[], options?: FormatElementOptions) {\n if (elements.length === 0) {\n return '(no elements)';\n }\n\n return elements.map((element) => formatElement(element, options)).join('\\n');\n}\n\nexport function formatJson(\n json: JsonNode | JsonNode[],\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n return prettyFormat(json, {\n plugins: [getElementJsonPlugin(mapProps), plugins.ReactElement],\n highlight: highlight,\n printBasicPrototype: false,\n min: compact,\n });\n}\n\nfunction getElementJsonPlugin(mapProps?: MapPropsFunction | null): 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) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer,\n );\n },\n };\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AAA8C,SAAAE,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,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ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S,EAAEA,CAACD,GAAG,EAAEE,MAAM,EAAEC,WAAW,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAO,KAAK;MAC7D,IAAIC,MAAM,GAAGP,GAAG;MAChB,IAAI5B,QAAQ,IAAI4B,GAAG,CAACjB,KAAK,EAAE;QACzBwB,MAAM,GAAG;UAAE,GAAGP,GAAG;UAAEjB,KAAK,EAAEX,QAAQ,CAAC4B,GAAG,CAACjB,KAAK;QAAE,CAAC;MACjD;MACA,OAAOC,qBAAO,CAACC,kBAAkB,CAACgB,SAAS,CACzCM,MAAM,EACNL,MAAM,EACNC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,OACF,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"format-element.js","names":["_prettyFormat","_interopRequireWildcard","require","_mapProps","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","formatElement","element","compact","highlight","mapProps","defaultMapProps","children","props","childrenToDisplay","undefined","prettyFormat","$$typeof","Symbol","for","type","plugins","ReactTestComponent","ReactElement","printFunctionName","printBasicPrototype","min","formatElementList","elements","options","length","map","join","formatJson","json","getElementJsonPlugin","test","val","serialize","config","indentation","depth","refs","printer","newVal"],"sources":["../../src/helpers/format-element.ts"],"sourcesContent":["import type { NewPlugin } from 'pretty-format';\nimport prettyFormat, { plugins } from 'pretty-format';\nimport type { HostElement, JsonNode } from 'universal-test-renderer';\n\nimport type { MapPropsFunction } from './map-props';\nimport { defaultMapProps } from './map-props';\n\nexport type FormatElementOptions = {\n /** Minimize used space. */\n compact?: boolean;\n\n /** Highlight the output. */\n highlight?: boolean;\n\n /** Filter or map props to display. */\n mapProps?: MapPropsFunction | null;\n};\n\n/***\n * Format given element as a pretty-printed string.\n *\n * @param element Element to format.\n */\nexport function formatElement(\n element: HostElement | null,\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n if (element == null) {\n return '(null)';\n }\n\n const { children, ...props } = element.props;\n const childrenToDisplay = typeof children === 'string' ? [children] : undefined;\n\n return prettyFormat(\n {\n // This prop is needed persuade the prettyFormat that the element is\n // a JsonNode instance, so it is formatted as JSX.\n $$typeof: Symbol.for('react.test.json'),\n type: `${element.type}`,\n props: mapProps ? mapProps(props) : props,\n children: childrenToDisplay,\n },\n // See: https://www.npmjs.com/package/pretty-format#usage-with-options\n {\n plugins: [plugins.ReactTestComponent, plugins.ReactElement],\n printFunctionName: false,\n printBasicPrototype: false,\n highlight: highlight,\n min: compact,\n },\n );\n}\n\nexport function formatElementList(elements: HostElement[], options?: FormatElementOptions) {\n if (elements.length === 0) {\n return '(no elements)';\n }\n\n return elements.map((element) => formatElement(element, options)).join('\\n');\n}\n\nexport function formatJson(\n json: JsonNode | JsonNode[],\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n return prettyFormat(json, {\n plugins: [getElementJsonPlugin(mapProps), plugins.ReactElement],\n highlight: highlight,\n printBasicPrototype: false,\n min: compact,\n });\n}\n\nfunction getElementJsonPlugin(mapProps?: MapPropsFunction | null): 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) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer,\n );\n },\n };\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AAA8C,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA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IAAI,EAAEC,OAAO,KAAK;MAC7D,IAAIC,MAAM,GAAGP,GAAG;MAChB,IAAI3B,QAAQ,IAAI2B,GAAG,CAACxB,KAAK,EAAE;QACzB+B,MAAM,GAAG;UAAE,GAAGP,GAAG;UAAExB,KAAK,EAAEH,QAAQ,CAAC2B,GAAG,CAACxB,KAAK;QAAE,CAAC;MACjD;MACA,OAAOQ,qBAAO,CAACC,kBAAkB,CAACgB,SAAS,CACzCM,MAAM,EACNL,MAAM,EACNC,WAAW,EACXC,KAAK,EACLC,IAAI,EACJC,OACF,CAAC;IACH;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,4 @@
1
1
  import type { HostElement } from 'universal-test-renderer';
2
- export declare const HOST_TEXT_NAMES: string[];
3
2
  /**
4
3
  * Checks if the given element is a host Text element.
5
4
  * @param element The element to check.
@@ -3,15 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.HOST_TEXT_NAMES = void 0;
7
6
  exports.isHostImage = isHostImage;
8
7
  exports.isHostModal = isHostModal;
9
8
  exports.isHostScrollView = isHostScrollView;
10
9
  exports.isHostSwitch = isHostSwitch;
11
10
  exports.isHostText = isHostText;
12
11
  exports.isHostTextInput = isHostTextInput;
13
- var _componentTree = require("./component-tree");
14
- const HOST_TEXT_NAMES = exports.HOST_TEXT_NAMES = ['Text', 'RCTText'];
12
+ const HOST_TEXT_NAMES = ['Text', 'RCTText'];
15
13
  const HOST_TEXT_INPUT_NAMES = ['TextInput'];
16
14
  const HOST_IMAGE_NAMES = ['Image'];
17
15
  const HOST_SWITCH_NAMES = ['RCTSwitch'];
@@ -23,7 +21,7 @@ const HOST_MODAL_NAMES = ['Modal'];
23
21
  * @param element The element to check.
24
22
  */
25
23
  function isHostText(element) {
26
- return (0, _componentTree.isValidElement)(element) && HOST_TEXT_NAMES.includes(element.type);
24
+ return typeof element?.type === 'string' && HOST_TEXT_NAMES.includes(element.type);
27
25
  }
28
26
 
29
27
  /**
@@ -31,7 +29,7 @@ function isHostText(element) {
31
29
  * @param element The element to check.
32
30
  */
33
31
  function isHostTextInput(element) {
34
- return (0, _componentTree.isValidElement)(element) && HOST_TEXT_INPUT_NAMES.includes(element.type);
32
+ return typeof element?.type === 'string' && HOST_TEXT_INPUT_NAMES.includes(element.type);
35
33
  }
36
34
 
37
35
  /**
@@ -39,7 +37,7 @@ function isHostTextInput(element) {
39
37
  * @param element The element to check.
40
38
  */
41
39
  function isHostImage(element) {
42
- return (0, _componentTree.isValidElement)(element) && HOST_IMAGE_NAMES.includes(element.type);
40
+ return typeof element?.type === 'string' && HOST_IMAGE_NAMES.includes(element.type);
43
41
  }
44
42
 
45
43
  /**
@@ -47,7 +45,7 @@ function isHostImage(element) {
47
45
  * @param element The element to check.
48
46
  */
49
47
  function isHostSwitch(element) {
50
- return (0, _componentTree.isValidElement)(element) && HOST_SWITCH_NAMES.includes(element.type);
48
+ return typeof element?.type === 'string' && HOST_SWITCH_NAMES.includes(element.type);
51
49
  }
52
50
 
53
51
  /**
@@ -55,7 +53,7 @@ function isHostSwitch(element) {
55
53
  * @param element The element to check.
56
54
  */
57
55
  function isHostScrollView(element) {
58
- return (0, _componentTree.isValidElement)(element) && HOST_SCROLL_VIEW_NAMES.includes(element.type);
56
+ return typeof element?.type === 'string' && HOST_SCROLL_VIEW_NAMES.includes(element.type);
59
57
  }
60
58
 
61
59
  /**
@@ -63,6 +61,6 @@ function isHostScrollView(element) {
63
61
  * @param element The element to check.
64
62
  */
65
63
  function isHostModal(element) {
66
- return (0, _componentTree.isValidElement)(element) && HOST_MODAL_NAMES.includes(element.type);
64
+ return typeof element?.type === 'string' && HOST_MODAL_NAMES.includes(element.type);
67
65
  }
68
66
  //# sourceMappingURL=host-component-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"host-component-names.js","names":["_componentTree","require","HOST_TEXT_NAMES","exports","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 type { HostElement } from 'universal-test-renderer';\n\nimport { isValidElement } from './component-tree';\n\nexport const 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":";;;;;;;;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,CAAC,MAAM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CAACF,OAAO,CAACG,IAAI,CAAC;AAC3E","ignoreList":[]}
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 type { HostElement } from 'universal-test-renderer';\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 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: HostElement | null) {\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: HostElement | null) {\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: HostElement | null) {\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: HostElement | null) {\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: HostElement | null) {\n return typeof element?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3F;;AAEA;AACA;AACA;AACA;AACO,SAASM,WAAWA,CAACP,OAA2B,EAAE;EACvD,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIH,gBAAgB,CAACI,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACrF","ignoreList":[]}
@@ -1,3 +1,25 @@
1
+ export declare const _console: {
2
+ debug: {
3
+ (...data: any[]): void;
4
+ (message?: any, ...optionalParams: any[]): void;
5
+ (message?: any, ...optionalParams: any[]): void;
6
+ };
7
+ info: {
8
+ (...data: any[]): void;
9
+ (message?: any, ...optionalParams: any[]): void;
10
+ (message?: any, ...optionalParams: any[]): void;
11
+ };
12
+ warn: {
13
+ (...data: any[]): void;
14
+ (message?: any, ...optionalParams: any[]): void;
15
+ (message?: any, ...optionalParams: any[]): void;
16
+ };
17
+ error: {
18
+ (...data: any[]): void;
19
+ (message?: any, ...optionalParams: any[]): void;
20
+ (message?: any, ...optionalParams: any[]): void;
21
+ };
22
+ };
1
23
  export declare const logger: {
2
24
  debug(message: unknown, ...args: unknown[]): void;
3
25
  info(message: unknown, ...args: unknown[]): void;
@@ -3,30 +3,35 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.logger = void 0;
7
- var _chalk = _interopRequireDefault(require("chalk"));
6
+ exports.logger = exports._console = void 0;
8
7
  var nodeConsole = _interopRequireWildcard(require("console"));
8
+ var _picocolors = _interopRequireDefault(require("picocolors"));
9
9
  var _redent = _interopRequireDefault(require("redent"));
10
10
  var nodeUtil = _interopRequireWildcard(require("util"));
11
- 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); }
12
- 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 && {}.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; }
13
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ const _console = exports._console = {
14
+ debug: nodeConsole.debug,
15
+ info: nodeConsole.info,
16
+ warn: nodeConsole.warn,
17
+ error: nodeConsole.error
18
+ };
14
19
  const logger = exports.logger = {
15
20
  debug(message, ...args) {
16
21
  const output = formatMessage('●', message, ...args);
17
- nodeConsole.debug(_chalk.default.dim(output));
22
+ _console.debug(_picocolors.default.dim(output));
18
23
  },
19
24
  info(message, ...args) {
20
25
  const output = formatMessage('●', message, ...args);
21
- nodeConsole.info(output);
26
+ _console.info(output);
22
27
  },
23
28
  warn(message, ...args) {
24
29
  const output = formatMessage('▲', message, ...args);
25
- nodeConsole.warn(_chalk.default.yellow(output));
30
+ _console.warn(_picocolors.default.yellow(output));
26
31
  },
27
32
  error(message, ...args) {
28
33
  const output = formatMessage('■', message, ...args);
29
- nodeConsole.error(_chalk.default.red(output));
34
+ _console.error(_picocolors.default.red(output));
30
35
  }
31
36
  };
32
37
  function formatMessage(symbol, message, ...args) {
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","names":["_chalk","_interopRequireDefault","require","nodeConsole","_interopRequireWildcard","_redent","nodeUtil","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","logger","exports","debug","message","args","output","formatMessage","chalk","dim","info","warn","yellow","error","red","symbol","formatted","format","indented","redent","trimStart"],"sources":["../../src/helpers/logger.ts"],"sourcesContent":["import chalk from 'chalk';\nimport * as nodeConsole from 'console';\nimport redent from 'redent';\nimport * as nodeUtil from 'util';\n\nexport const logger = {\n debug(message: unknown, ...args: unknown[]) {\n const output = formatMessage('●', message, ...args);\n nodeConsole.debug(chalk.dim(output));\n },\n\n info(message: unknown, ...args: unknown[]) {\n const output = formatMessage('●', message, ...args);\n nodeConsole.info(output);\n },\n\n warn(message: unknown, ...args: unknown[]) {\n const output = formatMessage('▲', message, ...args);\n nodeConsole.warn(chalk.yellow(output));\n },\n\n error(message: unknown, ...args: unknown[]) {\n const output = formatMessage('■', message, ...args);\n nodeConsole.error(chalk.red(output));\n },\n};\n\nfunction formatMessage(symbol: string, message: unknown, ...args: unknown[]) {\n const formatted = nodeUtil.format(message, ...args);\n const indented = redent(formatted, 4);\n return ` ${symbol} ${indented.trimStart()}\\n`;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,uBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,QAAA,GAAAF,uBAAA,CAAAF,OAAA;AAAiC,SAAAK,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,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA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,EAAE,GAAGC,IAAe,EAAE;IACzC,MAAMC,MAAM,GAAGC,aAAa,CAAC,GAAG,EAAEH,OAAO,EAAE,GAAGC,IAAI,CAAC;IACnD5B,WAAW,CAACiC,IAAI,CAACJ,MAAM,CAAC;EAC1B,CAAC;EAEDK,IAAIA,CAACP,OAAgB,EAAE,GAAGC,IAAe,EAAE;IACzC,MAAMC,MAAM,GAAGC,aAAa,CAAC,GAAG,EAAEH,OAAO,EAAE,GAAGC,IAAI,CAAC;IACnD5B,WAAW,CAACkC,IAAI,CAACH,cAAK,CAACI,MAAM,CAACN,MAAM,CAAC,CAAC;EACxC,CAAC;EAEDO,KAAKA,CAACT,OAAgB,EAAE,GAAGC,IAAe,EAAE;IAC1C,MAAMC,MAAM,GAAGC,aAAa,CAAC,GAAG,EAAEH,OAAO,EAAE,GAAGC,IAAI,CAAC;IACnD5B,WAAW,CAACoC,KAAK,CAACL,cAAK,CAACM,GAAG,CAACR,MAAM,CAAC,CAAC;EACtC;AACF,CAAC;AAED,SAASC,aAAaA,CAACQ,MAAc,EAAEX,OAAgB,EAAE,GAAGC,IAAe,EAAE;EAC3E,MAAMW,SAAS,GAAGpC,QAAQ,CAACqC,MAAM,CAACb,OAAO,EAAE,GAAGC,IAAI,CAAC;EACnD,MAAMa,QAAQ,GAAG,IAAAC,eAAM,EAACH,SAAS,EAAE,CAAC,CAAC;EACrC,OAAO,KAAKD,MAAM,IAAIG,QAAQ,CAACE,SAAS,CAAC,CAAC,IAAI;AAChD","ignoreList":[]}
1
+ {"version":3,"file":"logger.js","names":["nodeConsole","_interopRequireWildcard","require","_picocolors","_interopRequireDefault","_redent","nodeUtil","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_console","exports","debug","info","warn","error","logger","message","args","output","formatMessage","pc","dim","yellow","red","symbol","formatted","format","indented","redent","trimStart"],"sources":["../../src/helpers/logger.ts"],"sourcesContent":["import * as nodeConsole from 'console';\nimport pc from 'picocolors';\nimport redent from 'redent';\nimport * as nodeUtil from 'util';\n\nexport const _console = {\n debug: nodeConsole.debug,\n info: nodeConsole.info,\n warn: nodeConsole.warn,\n error: nodeConsole.error,\n};\n\nexport const logger = {\n debug(message: unknown, ...args: unknown[]) {\n const output = formatMessage('●', message, ...args);\n _console.debug(pc.dim(output));\n },\n\n info(message: unknown, ...args: unknown[]) {\n const output = formatMessage('●', message, ...args);\n _console.info(output);\n },\n\n warn(message: unknown, ...args: unknown[]) {\n const output = formatMessage('▲', message, ...args);\n _console.warn(pc.yellow(output));\n },\n\n error(message: unknown, ...args: unknown[]) {\n const output = formatMessage('■', message, ...args);\n _console.error(pc.red(output));\n },\n};\n\nfunction formatMessage(symbol: string, message: unknown, ...args: unknown[]) {\n const formatted = nodeUtil.format(message, ...args);\n const indented = redent(formatted, 4);\n return ` ${symbol} ${indented.trimStart()}\\n`;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAL,uBAAA,CAAAC,OAAA;AAAiC,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAR,OAAA,EAAAF,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAS,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I,CAAC;IACnDR,QAAQ,CAACG,IAAI,CAACM,MAAM,CAAC;EACvB,CAAC;EAEDL,IAAIA,CAACG,OAAgB,EAAE,GAAGC,IAAe,EAAE;IACzC,MAAMC,MAAM,GAAGC,aAAa,CAAC,GAAG,EAAEH,OAAO,EAAE,GAAGC,IAAI,CAAC;IACnDR,QAAQ,CAACI,IAAI,CAACO,mBAAE,CAACE,MAAM,CAACJ,MAAM,CAAC,CAAC;EAClC,CAAC;EAEDJ,KAAKA,CAACE,OAAgB,EAAE,GAAGC,IAAe,EAAE;IAC1C,MAAMC,MAAM,GAAGC,aAAa,CAAC,GAAG,EAAEH,OAAO,EAAE,GAAGC,IAAI,CAAC;IACnDR,QAAQ,CAACK,KAAK,CAACM,mBAAE,CAACG,GAAG,CAACL,MAAM,CAAC,CAAC;EAChC;AACF,CAAC;AAED,SAASC,aAAaA,CAACK,MAAc,EAAER,OAAgB,EAAE,GAAGC,IAAe,EAAE;EAC3E,MAAMQ,SAAS,GAAGpC,QAAQ,CAACqC,MAAM,CAACV,OAAO,EAAE,GAAGC,IAAI,CAAC;EACnD,MAAMU,QAAQ,GAAG,IAAAC,eAAM,EAACH,SAAS,EAAE,CAAC,CAAC;EACrC,OAAO,KAAKD,MAAM,IAAIG,QAAQ,CAACE,SAAS,CAAC,CAAC,IAAI;AAChD","ignoreList":[]}
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.isPointerEventEnabled = void 0;
7
+ var _reactNative = require("react-native");
7
8
  /**
8
9
  * pointerEvents controls whether the View can be the target of touch events.
9
10
  * 'auto': The View and its children can be the target of touch events.
@@ -12,13 +13,16 @@ exports.isPointerEventEnabled = void 0;
12
13
  * 'box-only': The view can be the target of touch events but its subviews cannot be
13
14
  * see the official react native doc https://reactnative.dev/docs/view#pointerevents */
14
15
  const isPointerEventEnabled = (element, isParent) => {
15
- const parentCondition = isParent ? element?.props.pointerEvents === 'box-only' : element?.props.pointerEvents === 'box-none';
16
- if (element?.props.pointerEvents === 'none' || parentCondition) {
16
+ // Check both props.pointerEvents and props.style.pointerEvents
17
+ const pointerEvents = element?.props.pointerEvents ?? _reactNative.StyleSheet.flatten(element?.props.style)?.pointerEvents;
18
+ const parentCondition = isParent ? pointerEvents === 'box-only' : pointerEvents === 'box-none';
19
+ if (pointerEvents === 'none' || parentCondition) {
17
20
  return false;
18
21
  }
19
- const hostParent = element.parent;
20
- if (!hostParent) return true;
21
- return isPointerEventEnabled(hostParent, true);
22
+ if (!element.parent) {
23
+ return true;
24
+ }
25
+ return isPointerEventEnabled(element.parent, true);
22
26
  };
23
27
  exports.isPointerEventEnabled = isPointerEventEnabled;
24
28
  //# sourceMappingURL=pointer-events.js.map
@@ -1 +1 @@
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 type { 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
+ {"version":3,"file":"pointer-events.js","names":["_reactNative","require","isPointerEventEnabled","element","isParent","pointerEvents","props","StyleSheet","flatten","style","parentCondition","parent","exports"],"sources":["../../src/helpers/pointer-events.ts"],"sourcesContent":["import { StyleSheet } from 'react-native';\nimport type { 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 // Check both props.pointerEvents and props.style.pointerEvents\n const pointerEvents =\n element?.props.pointerEvents ?? StyleSheet.flatten(element?.props.style)?.pointerEvents;\n\n const parentCondition = isParent ? pointerEvents === 'box-only' : pointerEvents === 'box-none';\n\n if (pointerEvents === 'none' || parentCondition) {\n return false;\n }\n\n if (!element.parent) {\n return true;\n }\n\n return isPointerEventEnabled(element.parent, true);\n};\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,qBAAqB,GAAGA,CAACC,OAAoB,EAAEC,QAAkB,KAAc;EAC1F;EACA,MAAMC,aAAa,GACjBF,OAAO,EAAEG,KAAK,CAACD,aAAa,IAAIE,uBAAU,CAACC,OAAO,CAACL,OAAO,EAAEG,KAAK,CAACG,KAAK,CAAC,EAAEJ,aAAa;EAEzF,MAAMK,eAAe,GAAGN,QAAQ,GAAGC,aAAa,KAAK,UAAU,GAAGA,aAAa,KAAK,UAAU;EAE9F,IAAIA,aAAa,KAAK,MAAM,IAAIK,eAAe,EAAE;IAC/C,OAAO,KAAK;EACd;EAEA,IAAI,CAACP,OAAO,CAACQ,MAAM,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,OAAOT,qBAAqB,CAACC,OAAO,CAACQ,MAAM,EAAE,IAAI,CAAC;AACpD,CAAC;AAACC,OAAA,CAAAV,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1,6 +1,5 @@
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
4
3
  *
5
4
  * @param callback Async callback to run
6
5
  * @returns Result of the callback
@@ -10,7 +10,6 @@ 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
14
13
  *
15
14
  * @param callback Async callback to run
16
15
  * @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 * 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":[]}
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":[]}
package/build/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  import './matchers/extend-expect';
2
- export { HostElement } from 'universal-test-renderer';
3
2
  export * from './pure';
@@ -55,10 +55,10 @@ declare type A11yRole =
55
55
 
56
56
  declare type A11yState = {|
57
57
  disabled?: boolean,
58
- selected ?: boolean,
59
- checked ?: boolean | 'mixed',
60
- busy ?: boolean,
61
- expanded ?: boolean,
58
+ selected?: boolean,
59
+ checked?: boolean | 'mixed',
60
+ busy?: boolean,
61
+ expanded?: boolean,
62
62
  |};
63
63
 
64
64
  declare type A11yValue = {
@@ -310,6 +310,7 @@ declare module '@testing-library/react-native' {
310
310
  declare interface RenderOptions {
311
311
  wrapper?: React.ComponentType<any>;
312
312
  createNodeMock?: (element: React.Element<any>) => any;
313
+ unstable_validateStringsRenderedWithinText?: boolean;
313
314
  unstable_isConcurrent?: boolean;
314
315
  unstable_strictMode?: boolean;
315
316
  unstable_concurrentUpdatesByDefault?: boolean;
package/build/index.js CHANGED
@@ -3,23 +3,12 @@
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
6
  require("./matchers/extend-expect");
16
- var _universalTestRenderer = require("universal-test-renderer");
17
7
  var _act = require("./act");
18
8
  var _flushMicroTasks = require("./flush-micro-tasks");
19
9
  var _pure = require("./pure");
20
10
  Object.keys(_pure).forEach(function (key) {
21
11
  if (key === "default" || key === "__esModule") return;
22
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
23
12
  if (key in exports && exports[key] === _pure[key]) return;
24
13
  Object.defineProperty(exports, key, {
25
14
  enumerable: true,
@@ -37,7 +26,7 @@ if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
37
26
  if (typeof afterEach === 'function') {
38
27
  afterEach(async () => {
39
28
  await (0, _flushMicroTasks.flushMicroTasks)();
40
- (0, _pure.cleanup)();
29
+ await (0, _pure.cleanupAsync)();
41
30
  });
42
31
  }
43
32
  if (typeof beforeAll === 'function' && typeof afterAll === 'function') {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["require","_universalTestRenderer","_act","_flushMicroTasks","_pure","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import './matchers/extend-expect';\n\nexport { HostElement } from 'universal-test-renderer';\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { cleanup } from './pure';\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 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":";;;;;;;;;;;;;;AAAAA,OAAA;AAEA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AA6BAK,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;AA3BA,IAAI,CAACS,OAAO,EAAEC,GAAG,EAAEC,sBAAsB,EAAE;EACzC;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnCA,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":["require","_act","_flushMicroTasks","_pure","Object","keys","forEach","key","exports","defineProperty","enumerable","get","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanupAsync","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import './matchers/extend-expect';\n\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { cleanupAsync } from './pure';\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 afterEach(async () => {\n await flushMicroTasks();\n await cleanupAsync();\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":";;;;;AAAAA,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AA6BAI,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAR,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AA3BA,IAAI,CAACK,OAAO,EAAEC,GAAG,EAAEC,sBAAsB,EAAE;EACzC;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnCA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,EAAC,CAAC;MACvB,MAAM,IAAAC,kBAAY,EAAC,CAAC;IACtB,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":[]}