@testing-library/react-native 14.0.0-alpha.4 → 14.0.0-alpha.6

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/README.md +2 -2
  2. package/build/act.d.ts +1 -4
  3. package/build/act.js +5 -3
  4. package/build/act.js.map +1 -1
  5. package/build/cleanup.d.ts +3 -5
  6. package/build/cleanup.js +2 -8
  7. package/build/cleanup.js.map +1 -1
  8. package/build/fire-event.d.ts +3 -10
  9. package/build/fire-event.js +7 -29
  10. package/build/fire-event.js.map +1 -1
  11. package/build/helpers/accessibility.d.ts +1 -1
  12. package/build/helpers/accessibility.js.map +1 -1
  13. package/build/helpers/component-tree.d.ts +1 -1
  14. package/build/helpers/component-tree.js.map +1 -1
  15. package/build/helpers/debug.d.ts +1 -1
  16. package/build/helpers/debug.js.map +1 -1
  17. package/build/helpers/find-all.d.ts +1 -1
  18. package/build/helpers/find-all.js.map +1 -1
  19. package/build/helpers/format-element.d.ts +1 -1
  20. package/build/helpers/format-element.js.map +1 -1
  21. package/build/helpers/host-component-names.d.ts +2 -1
  22. package/build/helpers/host-component-names.js +2 -1
  23. package/build/helpers/host-component-names.js.map +1 -1
  24. package/build/helpers/matchers/match-accessibility-state.d.ts +1 -1
  25. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  26. package/build/helpers/matchers/match-accessibility-value.d.ts +1 -1
  27. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  28. package/build/helpers/matchers/match-label-text.d.ts +1 -1
  29. package/build/helpers/matchers/match-label-text.js.map +1 -1
  30. package/build/helpers/matchers/match-text-content.d.ts +1 -1
  31. package/build/helpers/matchers/match-text-content.js.map +1 -1
  32. package/build/helpers/pointer-events.d.ts +1 -1
  33. package/build/helpers/pointer-events.js.map +1 -1
  34. package/build/helpers/text-content.d.ts +1 -1
  35. package/build/helpers/text-content.js.map +1 -1
  36. package/build/helpers/text-input.d.ts +1 -1
  37. package/build/helpers/text-input.js.map +1 -1
  38. package/build/helpers/timers.d.ts +3 -1
  39. package/build/helpers/timers.js +3 -1
  40. package/build/helpers/timers.js.map +1 -1
  41. package/build/index.js +1 -1
  42. package/build/index.js.map +1 -1
  43. package/build/matchers/to-be-busy.d.ts +1 -1
  44. package/build/matchers/to-be-busy.js.map +1 -1
  45. package/build/matchers/to-be-checked.d.ts +1 -1
  46. package/build/matchers/to-be-checked.js.map +1 -1
  47. package/build/matchers/to-be-disabled.d.ts +1 -1
  48. package/build/matchers/to-be-disabled.js.map +1 -1
  49. package/build/matchers/to-be-empty-element.d.ts +1 -1
  50. package/build/matchers/to-be-empty-element.js.map +1 -1
  51. package/build/matchers/to-be-expanded.d.ts +1 -1
  52. package/build/matchers/to-be-expanded.js.map +1 -1
  53. package/build/matchers/to-be-on-the-screen.d.ts +1 -1
  54. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  55. package/build/matchers/to-be-partially-checked.d.ts +1 -1
  56. package/build/matchers/to-be-partially-checked.js.map +1 -1
  57. package/build/matchers/to-be-selected.d.ts +1 -1
  58. package/build/matchers/to-be-selected.js.map +1 -1
  59. package/build/matchers/to-be-visible.d.ts +1 -1
  60. package/build/matchers/to-be-visible.js.map +1 -1
  61. package/build/matchers/to-contain-element.d.ts +1 -1
  62. package/build/matchers/to-contain-element.js.map +1 -1
  63. package/build/matchers/to-have-accessibility-value.d.ts +1 -1
  64. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  65. package/build/matchers/to-have-accessible-name.d.ts +1 -1
  66. package/build/matchers/to-have-accessible-name.js.map +1 -1
  67. package/build/matchers/to-have-display-value.d.ts +1 -1
  68. package/build/matchers/to-have-display-value.js.map +1 -1
  69. package/build/matchers/to-have-prop.d.ts +1 -1
  70. package/build/matchers/to-have-prop.js.map +1 -1
  71. package/build/matchers/to-have-style.d.ts +1 -1
  72. package/build/matchers/to-have-style.js.map +1 -1
  73. package/build/matchers/to-have-text-content.d.ts +1 -1
  74. package/build/matchers/to-have-text-content.js.map +1 -1
  75. package/build/matchers/types.d.ts +1 -1
  76. package/build/matchers/types.js.map +1 -1
  77. package/build/matchers/utils.d.ts +1 -1
  78. package/build/matchers/utils.js.map +1 -1
  79. package/build/native-state.d.ts +1 -1
  80. package/build/native-state.js.map +1 -1
  81. package/build/pure.d.ts +10 -12
  82. package/build/pure.js +12 -45
  83. package/build/pure.js.map +1 -1
  84. package/build/queries/display-value.d.ts +1 -1
  85. package/build/queries/display-value.js.map +1 -1
  86. package/build/queries/hint-text.d.ts +1 -1
  87. package/build/queries/hint-text.js.map +1 -1
  88. package/build/queries/label-text.d.ts +1 -1
  89. package/build/queries/label-text.js.map +1 -1
  90. package/build/queries/make-queries.d.ts +1 -1
  91. package/build/queries/make-queries.js +3 -4
  92. package/build/queries/make-queries.js.map +1 -1
  93. package/build/queries/placeholder-text.d.ts +1 -1
  94. package/build/queries/placeholder-text.js.map +1 -1
  95. package/build/queries/role.d.ts +1 -1
  96. package/build/queries/role.js.map +1 -1
  97. package/build/queries/test-id.d.ts +1 -1
  98. package/build/queries/test-id.js.map +1 -1
  99. package/build/queries/text.d.ts +1 -1
  100. package/build/queries/text.js.map +1 -1
  101. package/build/render-hook.d.ts +0 -8
  102. package/build/render-hook.js +3 -42
  103. package/build/render-hook.js.map +1 -1
  104. package/build/render.d.ts +7 -77
  105. package/build/render.js +26 -42
  106. package/build/render.js.map +1 -1
  107. package/build/screen.js +1 -5
  108. package/build/screen.js.map +1 -1
  109. package/build/test-utils/json.d.ts +1 -1
  110. package/build/test-utils/json.js.map +1 -1
  111. package/build/tsconfig.release.tsbuildinfo +1 -1
  112. package/build/types.js +4 -0
  113. package/build/user-event/clear.d.ts +1 -1
  114. package/build/user-event/clear.js.map +1 -1
  115. package/build/user-event/index.d.ts +1 -1
  116. package/build/user-event/index.js.map +1 -1
  117. package/build/user-event/paste.d.ts +1 -1
  118. package/build/user-event/paste.js.map +1 -1
  119. package/build/user-event/press/press.d.ts +1 -1
  120. package/build/user-event/press/press.js +2 -3
  121. package/build/user-event/press/press.js.map +1 -1
  122. package/build/user-event/scroll/scroll-to.d.ts +1 -1
  123. package/build/user-event/scroll/scroll-to.js.map +1 -1
  124. package/build/user-event/setup/setup.d.ts +1 -1
  125. package/build/user-event/setup/setup.js.map +1 -1
  126. package/build/user-event/type/type.d.ts +1 -1
  127. package/build/user-event/type/type.js.map +1 -1
  128. package/build/user-event/utils/dispatch-event.d.ts +1 -1
  129. package/build/user-event/utils/dispatch-event.js +2 -5
  130. package/build/user-event/utils/dispatch-event.js.map +1 -1
  131. package/build/user-event/utils/text-range.js +4 -0
  132. package/build/wait-for-element-to-be-removed.d.ts +1 -1
  133. package/build/wait-for-element-to-be-removed.js +3 -4
  134. package/build/wait-for-element-to-be-removed.js.map +1 -1
  135. package/build/wait-for.d.ts +1 -1
  136. package/build/wait-for.js +6 -7
  137. package/build/wait-for.js.map +1 -1
  138. package/build/within.d.ts +1 -1
  139. package/build/within.js.map +1 -1
  140. package/package.json +18 -20
  141. package/build/index.flow.js +0 -378
  142. package/build/render-act.d.ts +0 -3
  143. package/build/render-act.js +0 -29
  144. package/build/render-act.js.map +0 -1
  145. package/build/render-async.d.ts +0 -83
  146. package/build/render-async.js +0 -96
  147. package/build/render-async.js.map +0 -1
  148. package/typings/index.flow.js +0 -378
@@ -1 +1 @@
1
- {"version":3,"file":"test-id.js","names":["_findAll","require","_matches","_makeQueries","matchTestId","node","testId","options","exact","normalizer","matches","props","testID","queryAllByTestId","element","queryAllByTestIdFn","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByTestIdQueries","getByTestId","getAllByTestId","queryByTestId","findByTestId","findAllByTestId","exports"],"sources":["../../src/queries/test-id.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { findAll } from '../helpers/find-all';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport { matches } from '../matches';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport { makeQueries } from './make-queries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByTestIdOptions = CommonQueryOptions & TextMatchOptions;\n\nconst matchTestId = (node: HostElement, testId: TextMatch, options: TextMatchOptions = {}) => {\n const { exact, normalizer } = options;\n return matches(testId, node.props.testID, normalizer, exact);\n};\n\nconst queryAllByTestId = (element: HostElement): QueryAllByQuery<TextMatch, ByTestIdOptions> =>\n function queryAllByTestIdFn(testId, queryOptions) {\n return findAll(element, (node) => matchTestId(node, testId, queryOptions), queryOptions);\n };\n\nconst getMultipleError = (testId: TextMatch) =>\n `Found multiple elements with testID: ${String(testId)}`;\nconst getMissingError = (testId: TextMatch) =>\n `Unable to find an element with testID: ${String(testId)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByTestId,\n getMissingError,\n getMultipleError,\n);\n\nexport type ByTestIdQueries = {\n getByTestId: GetByQuery<TextMatch, ByTestIdOptions>;\n getAllByTestId: GetAllByQuery<TextMatch, ByTestIdOptions>;\n queryByTestId: QueryByQuery<TextMatch, ByTestIdOptions>;\n queryAllByTestId: QueryAllByQuery<TextMatch, ByTestIdOptions>;\n findByTestId: FindByQuery<TextMatch, ByTestIdOptions>;\n findAllByTestId: FindAllByQuery<TextMatch, ByTestIdOptions>;\n};\n\nexport const bindByTestIdQueries = (element: HostElement): ByTestIdQueries => ({\n getByTestId: getBy(element),\n getAllByTestId: getAllBy(element),\n queryByTestId: queryBy(element),\n queryAllByTestId: queryAllBy(element),\n findByTestId: findBy(element),\n findAllByTestId: findAllBy(element),\n});\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AASA,IAAAE,YAAA,GAAAF,OAAA;AAKA,MAAMG,WAAW,GAAGA,CAACC,IAAiB,EAAEC,MAAiB,EAAEC,OAAyB,GAAG,CAAC,CAAC,KAAK;EAC5F,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,OAAO,IAAAG,gBAAO,EAACJ,MAAM,EAAED,IAAI,CAACM,KAAK,CAACC,MAAM,EAAEH,UAAU,EAAED,KAAK,CAAC;AAC9D,CAAC;AAED,MAAMK,gBAAgB,GAAIC,OAAoB,IAC5C,SAASC,kBAAkBA,CAACT,MAAM,EAAEU,YAAY,EAAE;EAChD,OAAO,IAAAC,gBAAO,EAACH,OAAO,EAAGT,IAAI,IAAKD,WAAW,CAACC,IAAI,EAAEC,MAAM,EAAEU,YAAY,CAAC,EAAEA,YAAY,CAAC;AAC1F,CAAC;AAEH,MAAME,gBAAgB,GAAIZ,MAAiB,IACzC,wCAAwCa,MAAM,CAACb,MAAM,CAAC,EAAE;AAC1D,MAAMc,eAAe,GAAId,MAAiB,IACxC,0CAA0Ca,MAAM,CAACb,MAAM,CAAC,EAAE;AAE5D,MAAM;EAAEe,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7Ed,gBAAgB,EAChBO,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,mBAAmB,GAAId,OAAoB,KAAuB;EAC7Ee,WAAW,EAAER,KAAK,CAACP,OAAO,CAAC;EAC3BgB,cAAc,EAAER,QAAQ,CAACR,OAAO,CAAC;EACjCiB,aAAa,EAAER,OAAO,CAACT,OAAO,CAAC;EAC/BD,gBAAgB,EAAEW,UAAU,CAACV,OAAO,CAAC;EACrCkB,YAAY,EAAEP,MAAM,CAACX,OAAO,CAAC;EAC7BmB,eAAe,EAAEP,SAAS,CAACZ,OAAO;AACpC,CAAC,CAAC;AAACoB,OAAA,CAAAN,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"file":"test-id.js","names":["_findAll","require","_matches","_makeQueries","matchTestId","node","testId","options","exact","normalizer","matches","props","testID","queryAllByTestId","element","queryAllByTestIdFn","queryOptions","findAll","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByTestIdQueries","getByTestId","getAllByTestId","queryByTestId","findByTestId","findAllByTestId","exports"],"sources":["../../src/queries/test-id.ts"],"sourcesContent":["import type { HostElement } from 'test-renderer';\n\nimport { findAll } from '../helpers/find-all';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport { matches } from '../matches';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport { makeQueries } from './make-queries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByTestIdOptions = CommonQueryOptions & TextMatchOptions;\n\nconst matchTestId = (node: HostElement, testId: TextMatch, options: TextMatchOptions = {}) => {\n const { exact, normalizer } = options;\n return matches(testId, node.props.testID, normalizer, exact);\n};\n\nconst queryAllByTestId = (element: HostElement): QueryAllByQuery<TextMatch, ByTestIdOptions> =>\n function queryAllByTestIdFn(testId, queryOptions) {\n return findAll(element, (node) => matchTestId(node, testId, queryOptions), queryOptions);\n };\n\nconst getMultipleError = (testId: TextMatch) =>\n `Found multiple elements with testID: ${String(testId)}`;\nconst getMissingError = (testId: TextMatch) =>\n `Unable to find an element with testID: ${String(testId)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByTestId,\n getMissingError,\n getMultipleError,\n);\n\nexport type ByTestIdQueries = {\n getByTestId: GetByQuery<TextMatch, ByTestIdOptions>;\n getAllByTestId: GetAllByQuery<TextMatch, ByTestIdOptions>;\n queryByTestId: QueryByQuery<TextMatch, ByTestIdOptions>;\n queryAllByTestId: QueryAllByQuery<TextMatch, ByTestIdOptions>;\n findByTestId: FindByQuery<TextMatch, ByTestIdOptions>;\n findAllByTestId: FindAllByQuery<TextMatch, ByTestIdOptions>;\n};\n\nexport const bindByTestIdQueries = (element: HostElement): ByTestIdQueries => ({\n getByTestId: getBy(element),\n getAllByTestId: getAllBy(element),\n queryByTestId: queryBy(element),\n queryAllByTestId: queryAllBy(element),\n findByTestId: findBy(element),\n findAllByTestId: findAllBy(element),\n});\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AASA,IAAAE,YAAA,GAAAF,OAAA;AAKA,MAAMG,WAAW,GAAGA,CAACC,IAAiB,EAAEC,MAAiB,EAAEC,OAAyB,GAAG,CAAC,CAAC,KAAK;EAC5F,MAAM;IAAEC,KAAK;IAAEC;EAAW,CAAC,GAAGF,OAAO;EACrC,OAAO,IAAAG,gBAAO,EAACJ,MAAM,EAAED,IAAI,CAACM,KAAK,CAACC,MAAM,EAAEH,UAAU,EAAED,KAAK,CAAC;AAC9D,CAAC;AAED,MAAMK,gBAAgB,GAAIC,OAAoB,IAC5C,SAASC,kBAAkBA,CAACT,MAAM,EAAEU,YAAY,EAAE;EAChD,OAAO,IAAAC,gBAAO,EAACH,OAAO,EAAGT,IAAI,IAAKD,WAAW,CAACC,IAAI,EAAEC,MAAM,EAAEU,YAAY,CAAC,EAAEA,YAAY,CAAC;AAC1F,CAAC;AAEH,MAAME,gBAAgB,GAAIZ,MAAiB,IACzC,wCAAwCa,MAAM,CAACb,MAAM,CAAC,EAAE;AAC1D,MAAMc,eAAe,GAAId,MAAiB,IACxC,0CAA0Ca,MAAM,CAACb,MAAM,CAAC,EAAE;AAE5D,MAAM;EAAEe,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7Ed,gBAAgB,EAChBO,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,mBAAmB,GAAId,OAAoB,KAAuB;EAC7Ee,WAAW,EAAER,KAAK,CAACP,OAAO,CAAC;EAC3BgB,cAAc,EAAER,QAAQ,CAACR,OAAO,CAAC;EACjCiB,aAAa,EAAER,OAAO,CAACT,OAAO,CAAC;EAC/BD,gBAAgB,EAAEW,UAAU,CAACV,OAAO,CAAC;EACrCkB,YAAY,EAAEP,MAAM,CAACX,OAAO,CAAC;EAC7BmB,eAAe,EAAEP,SAAS,CAACZ,OAAO;AACpC,CAAC,CAAC;AAACoB,OAAA,CAAAN,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'test-renderer';
2
2
  import type { TextMatch, TextMatchOptions } from '../matches';
3
3
  import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
4
4
  import type { CommonQueryOptions } from './options';
@@ -1 +1 @@
1
- {"version":3,"file":"text.js","names":["_findAll","require","_hostComponentNames","_matchTextContent","_makeQueries","queryAllByText","element","queryAllByTextFn","text","options","findAll","node","isHostText","matchTextContent","matchDeepestOnly","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByTextQueries","getByText","getAllByText","queryByText","findByText","findAllByText","exports"],"sources":["../../src/queries/text.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { findAll } from '../helpers/find-all';\nimport { isHostText } from '../helpers/host-component-names';\nimport { matchTextContent } from '../helpers/matchers/match-text-content';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport { makeQueries } from './make-queries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst queryAllByText = (element: HostElement): QueryAllByQuery<TextMatch, ByTextOptions> =>\n function queryAllByTextFn(text, options = {}) {\n return findAll(element, (node) => isHostText(node) && matchTextContent(node, text, options), {\n ...options,\n matchDeepestOnly: true,\n });\n };\n\nconst getMultipleError = (text: TextMatch) => `Found multiple elements with text: ${String(text)}`;\n\nconst getMissingError = (text: TextMatch) => `Unable to find an element with text: ${String(text)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByText,\n getMissingError,\n getMultipleError,\n);\n\nexport type ByTextQueries = {\n getByText: GetByQuery<TextMatch, ByTextOptions>;\n getAllByText: GetAllByQuery<TextMatch, ByTextOptions>;\n queryByText: QueryByQuery<TextMatch, ByTextOptions>;\n queryAllByText: QueryAllByQuery<TextMatch, ByTextOptions>;\n findByText: FindByQuery<TextMatch, ByTextOptions>;\n findAllByText: FindAllByQuery<TextMatch, ByTextOptions>;\n};\n\nexport const bindByTextQueries = (element: HostElement): ByTextQueries => ({\n getByText: getBy(element),\n getAllByText: getAllBy(element),\n queryByText: queryBy(element),\n queryAllByText: queryAllBy(element),\n findByText: findBy(element),\n findAllByText: findAllBy(element),\n});\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAUA,IAAAG,YAAA,GAAAH,OAAA;AAKA,MAAMI,cAAc,GAAIC,OAAoB,IAC1C,SAASC,gBAAgBA,CAACC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EAC5C,OAAO,IAAAC,gBAAO,EAACJ,OAAO,EAAGK,IAAI,IAAK,IAAAC,8BAAU,EAACD,IAAI,CAAC,IAAI,IAAAE,kCAAgB,EAACF,IAAI,EAAEH,IAAI,EAAEC,OAAO,CAAC,EAAE;IAC3F,GAAGA,OAAO;IACVK,gBAAgB,EAAE;EACpB,CAAC,CAAC;AACJ,CAAC;AAEH,MAAMC,gBAAgB,GAAIP,IAAe,IAAK,sCAAsCQ,MAAM,CAACR,IAAI,CAAC,EAAE;AAElG,MAAMS,eAAe,GAAIT,IAAe,IAAK,wCAAwCQ,MAAM,CAACR,IAAI,CAAC,EAAE;AAEnG,MAAM;EAAEU,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EnB,cAAc,EACdY,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,iBAAiB,GAAInB,OAAoB,KAAqB;EACzEoB,SAAS,EAAER,KAAK,CAACZ,OAAO,CAAC;EACzBqB,YAAY,EAAER,QAAQ,CAACb,OAAO,CAAC;EAC/BsB,WAAW,EAAER,OAAO,CAACd,OAAO,CAAC;EAC7BD,cAAc,EAAEgB,UAAU,CAACf,OAAO,CAAC;EACnCuB,UAAU,EAAEP,MAAM,CAAChB,OAAO,CAAC;EAC3BwB,aAAa,EAAEP,SAAS,CAACjB,OAAO;AAClC,CAAC,CAAC;AAACyB,OAAA,CAAAN,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"file":"text.js","names":["_findAll","require","_hostComponentNames","_matchTextContent","_makeQueries","queryAllByText","element","queryAllByTextFn","text","options","findAll","node","isHostText","matchTextContent","matchDeepestOnly","getMultipleError","String","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByTextQueries","getByText","getAllByText","queryByText","findByText","findAllByText","exports"],"sources":["../../src/queries/text.ts"],"sourcesContent":["import type { HostElement } from 'test-renderer';\n\nimport { findAll } from '../helpers/find-all';\nimport { isHostText } from '../helpers/host-component-names';\nimport { matchTextContent } from '../helpers/matchers/match-text-content';\nimport type { TextMatch, TextMatchOptions } from '../matches';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport { makeQueries } from './make-queries';\nimport type { CommonQueryOptions } from './options';\n\ntype ByTextOptions = CommonQueryOptions & TextMatchOptions;\n\nconst queryAllByText = (element: HostElement): QueryAllByQuery<TextMatch, ByTextOptions> =>\n function queryAllByTextFn(text, options = {}) {\n return findAll(element, (node) => isHostText(node) && matchTextContent(node, text, options), {\n ...options,\n matchDeepestOnly: true,\n });\n };\n\nconst getMultipleError = (text: TextMatch) => `Found multiple elements with text: ${String(text)}`;\n\nconst getMissingError = (text: TextMatch) => `Unable to find an element with text: ${String(text)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByText,\n getMissingError,\n getMultipleError,\n);\n\nexport type ByTextQueries = {\n getByText: GetByQuery<TextMatch, ByTextOptions>;\n getAllByText: GetAllByQuery<TextMatch, ByTextOptions>;\n queryByText: QueryByQuery<TextMatch, ByTextOptions>;\n queryAllByText: QueryAllByQuery<TextMatch, ByTextOptions>;\n findByText: FindByQuery<TextMatch, ByTextOptions>;\n findAllByText: FindAllByQuery<TextMatch, ByTextOptions>;\n};\n\nexport const bindByTextQueries = (element: HostElement): ByTextQueries => ({\n getByText: getBy(element),\n getAllByText: getAllBy(element),\n queryByText: queryBy(element),\n queryAllByText: queryAllBy(element),\n findByText: findBy(element),\n findAllByText: findAllBy(element),\n});\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAUA,IAAAG,YAAA,GAAAH,OAAA;AAKA,MAAMI,cAAc,GAAIC,OAAoB,IAC1C,SAASC,gBAAgBA,CAACC,IAAI,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EAC5C,OAAO,IAAAC,gBAAO,EAACJ,OAAO,EAAGK,IAAI,IAAK,IAAAC,8BAAU,EAACD,IAAI,CAAC,IAAI,IAAAE,kCAAgB,EAACF,IAAI,EAAEH,IAAI,EAAEC,OAAO,CAAC,EAAE;IAC3F,GAAGA,OAAO;IACVK,gBAAgB,EAAE;EACpB,CAAC,CAAC;AACJ,CAAC;AAEH,MAAMC,gBAAgB,GAAIP,IAAe,IAAK,sCAAsCQ,MAAM,CAACR,IAAI,CAAC,EAAE;AAElG,MAAMS,eAAe,GAAIT,IAAe,IAAK,wCAAwCQ,MAAM,CAACR,IAAI,CAAC,EAAE;AAEnG,MAAM;EAAEU,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EnB,cAAc,EACdY,eAAe,EACfF,gBACF,CAAC;AAWM,MAAMU,iBAAiB,GAAInB,OAAoB,KAAqB;EACzEoB,SAAS,EAAER,KAAK,CAACZ,OAAO,CAAC;EACzBqB,YAAY,EAAER,QAAQ,CAACb,OAAO,CAAC;EAC/BsB,WAAW,EAAER,OAAO,CAACd,OAAO,CAAC;EAC7BD,cAAc,EAAEgB,UAAU,CAACf,OAAO,CAAC;EACnCuB,UAAU,EAAEP,MAAM,CAAChB,OAAO,CAAC;EAC3BwB,aAAa,EAAEP,SAAS,CAACjB,OAAO;AAClC,CAAC,CAAC;AAACyB,OAAA,CAAAN,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -5,12 +5,6 @@ export type RenderHookResult<Result, Props> = {
5
5
  rerender: (props: Props) => Promise<void>;
6
6
  unmount: () => Promise<void>;
7
7
  };
8
- /** @deprecated - Use `renderHook` and `RenderHookResult` instead. */
9
- export type RenderHookSyncResult<Result, Props> = {
10
- result: RefObject<Result>;
11
- rerender: (props: Props) => void;
12
- unmount: () => void;
13
- };
14
8
  export type RenderHookOptions<Props> = {
15
9
  /**
16
10
  * The initial props to pass to the hook.
@@ -23,5 +17,3 @@ export type RenderHookOptions<Props> = {
23
17
  wrapper?: React.ComponentType<any>;
24
18
  };
25
19
  export declare function renderHook<Result, Props>(hookToRender: (props: Props) => Result, options?: RenderHookOptions<NoInfer<Props>>): Promise<RenderHookResult<Result, Props>>;
26
- /** @deprecated - Use async `renderHook` instead. */
27
- export declare function deprecated_renderHookSync<Result, Props>(hookToRender: (props: Props) => Result, options?: RenderHookOptions<NoInfer<Props>>): RenderHookSyncResult<Result, Props>;
@@ -3,50 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.deprecated_renderHookSync = deprecated_renderHookSync;
7
6
  exports.renderHook = renderHook;
8
7
  var React = _interopRequireWildcard(require("react"));
9
- var _render = _interopRequireDefault(require("./render"));
10
- var _renderAsync = _interopRequireDefault(require("./render-async"));
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
8
+ var _render = require("./render");
12
9
  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
- /** @deprecated - Use `renderHook` and `RenderHookResult` instead. */
14
-
15
10
  async function renderHook(hookToRender, options) {
16
- const result = /*#__PURE__*/React.createRef();
17
- function HookContainer({
18
- hookProps
19
- }) {
20
- const renderResult = hookToRender(hookProps);
21
- React.useEffect(() => {
22
- result.current = renderResult;
23
- });
24
- return null;
25
- }
26
- const {
27
- initialProps,
28
- ...renderOptions
29
- } = options ?? {};
30
- const {
31
- rerenderAsync: rerenderComponentAsync,
32
- unmountAsync
33
- } = await (0, _renderAsync.default)(
34
- /*#__PURE__*/
35
- // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt
36
- React.createElement(HookContainer, {
37
- hookProps: initialProps
38
- }), renderOptions);
39
- return {
40
- result: result,
41
- rerender: hookProps => rerenderComponentAsync(/*#__PURE__*/React.createElement(HookContainer, {
42
- hookProps: hookProps
43
- })),
44
- unmount: unmountAsync
45
- };
46
- }
47
-
48
- /** @deprecated - Use async `renderHook` instead. */
49
- function deprecated_renderHookSync(hookToRender, options) {
50
11
  const result = /*#__PURE__*/React.createRef();
51
12
  function HookContainer({
52
13
  hookProps
@@ -64,9 +25,9 @@ function deprecated_renderHookSync(hookToRender, options) {
64
25
  const {
65
26
  rerender: rerenderComponent,
66
27
  unmount
67
- } = (0, _render.default)(
28
+ } = await (0, _render.render)(
68
29
  /*#__PURE__*/
69
- // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt
30
+ // @ts-expect-error since option can be undefined, initialProps can be undefined when it shouldn't be
70
31
  React.createElement(HookContainer, {
71
32
  hookProps: initialProps
72
33
  }), renderOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"render-hook.js","names":["React","_interopRequireWildcard","require","_render","_interopRequireDefault","_renderAsync","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","renderHook","hookToRender","options","result","createRef","HookContainer","hookProps","renderResult","useEffect","current","initialProps","renderOptions","rerenderAsync","rerenderComponentAsync","unmountAsync","renderAsync","createElement","rerender","unmount","deprecated_renderHookSync","rerenderComponent","render"],"sources":["../src/render-hook.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport render from './render';\nimport renderAsync from './render-async';\nimport type { RefObject } from './types';\n\nexport type RenderHookResult<Result, Props> = {\n result: RefObject<Result>;\n rerender: (props: Props) => Promise<void>;\n unmount: () => Promise<void>;\n};\n\n/** @deprecated - Use `renderHook` and `RenderHookResult` instead. */\nexport type RenderHookSyncResult<Result, Props> = {\n result: RefObject<Result>;\n rerender: (props: Props) => void;\n unmount: () => void;\n};\n\nexport type RenderHookOptions<Props> = {\n /**\n * The initial props to pass to the hook.\n */\n initialProps?: Props;\n\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrapper?: React.ComponentType<any>;\n};\n\nexport async function renderHook<Result, Props>(\n hookToRender: (props: Props) => Result,\n options?: RenderHookOptions<NoInfer<Props>>,\n): Promise<RenderHookResult<Result, Props>> {\n const result = React.createRef<Result>() as RefObject<Result>;\n\n function HookContainer({ hookProps }: { hookProps: Props }) {\n const renderResult = hookToRender(hookProps);\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { initialProps, ...renderOptions } = options ?? {};\n const { rerenderAsync: rerenderComponentAsync, unmountAsync } = await renderAsync(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt\n <HookContainer hookProps={initialProps} />,\n renderOptions,\n );\n\n return {\n result: result,\n rerender: (hookProps: Props) => rerenderComponentAsync(<HookContainer hookProps={hookProps} />),\n unmount: unmountAsync,\n };\n}\n\n/** @deprecated - Use async `renderHook` instead. */\nexport function deprecated_renderHookSync<Result, Props>(\n hookToRender: (props: Props) => Result,\n options?: RenderHookOptions<NoInfer<Props>>,\n): RenderHookSyncResult<Result, Props> {\n const result = React.createRef<Result>() as RefObject<Result>;\n\n function HookContainer({ hookProps }: { hookProps: Props }) {\n const renderResult = hookToRender(hookProps);\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { initialProps, ...renderOptions } = options ?? {};\n const { rerender: rerenderComponent, unmount } = render(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it should'nt\n <HookContainer hookProps={initialProps} />,\n renderOptions,\n );\n\n return {\n result: result,\n rerender: (hookProps: Props) => rerenderComponent(<HookContainer hookProps={hookProps} />),\n unmount,\n };\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,YAAA,GAAAD,sBAAA,CAAAF,OAAA;AAAyC,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAG,CAAA,6BAA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A,CAACX,aAAa;MAACC,SAAS,EAAEA;IAAU,CAAE,CAAC,CAAC;IAC1FY;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"render-hook.js","names":["React","_interopRequireWildcard","require","_render","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","renderHook","hookToRender","options","result","createRef","HookContainer","hookProps","renderResult","useEffect","current","initialProps","renderOptions","rerender","rerenderComponent","unmount","render","createElement"],"sources":["../src/render-hook.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { render } from './render';\nimport type { RefObject } from './types';\n\nexport type RenderHookResult<Result, Props> = {\n result: RefObject<Result>;\n rerender: (props: Props) => Promise<void>;\n unmount: () => Promise<void>;\n};\n\nexport type RenderHookOptions<Props> = {\n /**\n * The initial props to pass to the hook.\n */\n initialProps?: Props;\n\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrapper?: React.ComponentType<any>;\n};\n\nexport async function renderHook<Result, Props>(\n hookToRender: (props: Props) => Result,\n options?: RenderHookOptions<NoInfer<Props>>,\n): Promise<RenderHookResult<Result, Props>> {\n const result = React.createRef<Result>() as RefObject<Result>;\n\n function HookContainer({ hookProps }: { hookProps: Props }) {\n const renderResult = hookToRender(hookProps);\n React.useEffect(() => {\n result.current = renderResult;\n });\n\n return null;\n }\n\n const { initialProps, ...renderOptions } = options ?? {};\n const { rerender: rerenderComponent, unmount } = await render(\n // @ts-expect-error since option can be undefined, initialProps can be undefined when it shouldn't be\n <HookContainer hookProps={initialProps} />,\n renderOptions,\n );\n\n return {\n result: result,\n rerender: (hookProps: Props) => rerenderComponent(<HookContainer hookProps={hookProps} />),\n unmount,\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GA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pBL,MAAM,CAACM,OAAO,GAAGF,YAAY;IAC/B,CAAC,CAAC;IAEF,OAAO,IAAI;EACb;EAEA,MAAM;IAAEG,YAAY;IAAE,GAAGC;EAAc,CAAC,GAAGT,OAAO,IAAI,CAAC,CAAC;EACxD,MAAM;IAAEU,QAAQ,EAAEC,iBAAiB;IAAEC;EAAQ,CAAC,GAAG,MAAM,IAAAC,cAAM;EAAA;EAC3D;EACAtC,KAAA,CAAAuC,aAAA,CAACX,aAAa;IAACC,SAAS,EAAEI;EAAa,CAAE,CAAC,EAC1CC,aACF,CAAC;EAED,OAAO;IACLR,MAAM,EAAEA,MAAM;IACdS,QAAQ,EAAGN,SAAgB,IAAKO,iBAAiB,cAACpC,KAAA,CAAAuC,aAAA,CAACX,aAAa;MAACC,SAAS,EAAEA;IAAU,CAAE,CAAC,CAAC;IAC1FQ;EACF,CAAC;AACH","ignoreList":[]}
package/build/render.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { HostElement, JsonElement } from 'universal-test-renderer';
2
+ import { type HostElement, type JsonElement } from 'test-renderer';
3
3
  import type { DebugOptions } from './helpers/debug';
4
4
  export interface RenderOptions {
5
5
  /**
@@ -7,20 +7,16 @@ export interface RenderOptions {
7
7
  * reusable custom render functions for common data providers.
8
8
  */
9
9
  wrapper?: React.ComponentType<any>;
10
- createNodeMock?: (element: React.ReactElement) => unknown;
10
+ createNodeMock?: (element: React.ReactElement) => object;
11
11
  }
12
- export type RenderResult = ReturnType<typeof render>;
12
+ export type RenderResult = Awaited<ReturnType<typeof render>>;
13
13
  /**
14
14
  * Renders test component deeply using React Test Renderer and exposes helpers
15
15
  * to assert on the output.
16
16
  */
17
- export default function render<T>(component: React.ReactElement<T>, options?: RenderOptions): {
18
- rerender: (component: React.ReactElement) => void;
19
- rerenderAsync: (component: React.ReactElement) => Promise<void>;
20
- update: (component: React.ReactElement) => void;
21
- updateAsync: (component: React.ReactElement) => Promise<void>;
22
- unmount: () => void;
23
- unmountAsync: () => Promise<void>;
17
+ export declare function render<T>(element: React.ReactElement<T>, options?: RenderOptions): Promise<{
18
+ rerender: (component: React.ReactElement) => Promise<void>;
19
+ unmount: () => Promise<void>;
24
20
  toJSON: () => JsonElement | null;
25
21
  debug: DebugFunction;
26
22
  container: HostElement;
@@ -79,71 +75,5 @@ export default function render<T>(component: React.ReactElement<T>, options?: Re
79
75
  queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
80
76
  findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
81
77
  findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
82
- };
83
- export declare function renderInternal<T>(component: React.ReactElement<T>, options?: RenderOptions): {
84
- rerender: (component: React.ReactElement) => void;
85
- rerenderAsync: (component: React.ReactElement) => Promise<void>;
86
- update: (component: React.ReactElement) => void;
87
- updateAsync: (component: React.ReactElement) => Promise<void>;
88
- unmount: () => void;
89
- unmountAsync: () => Promise<void>;
90
- toJSON: () => JsonElement | null;
91
- debug: DebugFunction;
92
- container: HostElement;
93
- root: HostElement | null;
94
- getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
95
- getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
96
- queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
97
- queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
98
- findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
99
- findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
100
- getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
101
- getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
102
- queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
103
- queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
104
- findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
105
- findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
106
- getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
107
- getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
108
- queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
109
- queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
110
- findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
111
- findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
112
- getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
113
- getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
114
- queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
115
- queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
116
- findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
117
- findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
118
- getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
119
- getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
120
- queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
121
- queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
122
- findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
123
- findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
124
- getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
125
- getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
126
- queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
127
- queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
128
- findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
129
- findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
130
- getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
131
- getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
132
- queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
133
- queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
134
- findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
135
- findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
136
- getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
137
- getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
138
- queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
139
- queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
140
- findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
141
- findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
142
- getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
143
- getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
144
- queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
145
- queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
146
- findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
147
- findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
148
- };
78
+ }>;
149
79
  export type DebugFunction = (options?: DebugOptions) => void;
package/build/render.js CHANGED
@@ -3,62 +3,51 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = render;
7
- exports.renderInternal = renderInternal;
6
+ exports.render = render;
8
7
  var React = _interopRequireWildcard(require("react"));
9
- var _act = _interopRequireDefault(require("./act"));
8
+ var _testRenderer = require("test-renderer");
9
+ var _act = require("./act");
10
10
  var _cleanup = require("./cleanup");
11
11
  var _config = require("./config");
12
12
  var _debug = require("./helpers/debug");
13
- var _renderAct = require("./render-act");
13
+ var _hostComponentNames = require("./helpers/host-component-names");
14
14
  var _screen = require("./screen");
15
15
  var _within = require("./within");
16
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
16
  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); }
18
17
  /**
19
18
  * Renders test component deeply using React Test Renderer and exposes helpers
20
19
  * to assert on the output.
21
20
  */
22
- function render(component, options = {}) {
23
- return renderInternal(component, options);
24
- }
25
- function renderInternal(component, options) {
21
+ async function render(element, options = {}) {
26
22
  const {
27
- wrapper: Wrapper
23
+ wrapper: Wrapper,
24
+ createNodeMock
28
25
  } = options || {};
29
-
30
- // TODO allow passing some options
31
- const rendererOptions = {};
32
- const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
33
- const renderer = (0, _renderAct.renderWithAct)(wrap(component), rendererOptions);
34
- return buildRenderResult(renderer, wrap);
35
- }
36
- function buildRenderResult(renderer, wrap) {
37
- const rerender = component => {
38
- void (0, _act.default)(() => {
39
- renderer.render(wrap(component));
40
- });
26
+ const rendererOptions = {
27
+ textComponentTypes: _hostComponentNames.HOST_TEXT_NAMES,
28
+ publicTextComponentTypes: ['Text'],
29
+ createNodeMock
41
30
  };
42
- const rerenderAsync = async component => {
43
- // eslint-disable-next-line require-await
44
- await (0, _act.default)(async () => {
31
+ const wrap = element => Wrapper ? /*#__PURE__*/React.createElement(Wrapper, null, element) : element;
32
+ const renderer = (0, _testRenderer.createRoot)(rendererOptions);
33
+ await (0, _act.act)(() => {
34
+ renderer.render(wrap(element));
35
+ });
36
+ const container = renderer.container;
37
+ const rerender = async component => {
38
+ await (0, _act.act)(() => {
45
39
  renderer.render(wrap(component));
46
40
  });
47
41
  };
48
- const unmount = () => {
49
- void (0, _act.default)(() => {
50
- renderer.unmount();
51
- });
52
- };
53
- const unmountAsync = async () => {
54
- // eslint-disable-next-line require-await
55
- await (0, _act.default)(async () => {
42
+ const unmount = async () => {
43
+ await (0, _act.act)(() => {
56
44
  renderer.unmount();
57
45
  });
58
46
  };
59
47
  const toJSON = () => {
60
48
  const json = renderer.container.toJSON();
61
- if (json?.children?.length === 0) {
49
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
50
+ if (json?.children.length === 0) {
62
51
  return null;
63
52
  }
64
53
  if (json?.children?.length === 1 && typeof json.children[0] !== 'string') {
@@ -66,25 +55,20 @@ function buildRenderResult(renderer, wrap) {
66
55
  }
67
56
  return json;
68
57
  };
69
- (0, _cleanup.addToCleanupQueue)(unmountAsync);
58
+ (0, _cleanup.addToCleanupQueue)(unmount);
70
59
  const result = {
71
60
  ...(0, _within.getQueriesForElement)(renderer.container),
72
61
  rerender,
73
- rerenderAsync,
74
- update: rerender,
75
- // alias for 'rerender'
76
- updateAsync: rerenderAsync,
77
- // alias for `rerenderAsync`
78
62
  unmount,
79
- unmountAsync,
80
63
  toJSON,
81
64
  debug: makeDebug(renderer),
82
65
  get container() {
83
66
  return renderer.container;
84
67
  },
85
68
  get root() {
86
- const firstChild = renderer.container.children[0];
69
+ const firstChild = container.children[0];
87
70
  if (typeof firstChild === 'string') {
71
+ /* istanbul ignore next */
88
72
  throw new Error('Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.');
89
73
  }
90
74
  return firstChild;
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["React","_interopRequireWildcard","require","_act","_interopRequireDefault","_cleanup","_config","_debug","_renderAct","_screen","_within","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","render","component","options","renderInternal","wrapper","Wrapper","rendererOptions","wrap","element","createElement","renderer","renderWithAct","buildRenderResult","rerender","act","rerenderAsync","unmount","unmountAsync","toJSON","json","container","children","length","addToCleanupQueue","result","getQueriesForElement","update","updateAsync","debug","makeDebug","root","firstChild","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions"],"sources":["../src/render.tsx"],"sourcesContent":["import * as React from 'react';\nimport type { HostElement, JsonElement, Root, RootOptions } from 'universal-test-renderer';\n\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport type { DebugOptions } from './helpers/debug';\nimport { debug } from './helpers/debug';\nimport { renderWithAct } from './render-act';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrapper?: React.ComponentType<any>;\n\n createNodeMock?: (element: React.ReactElement) => unknown;\n}\n\nexport type RenderResult = ReturnType<typeof render>;\n\n/**\n * Renders test component deeply using React Test Renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(component: React.ReactElement<T>, options: RenderOptions = {}) {\n return renderInternal(component, options);\n}\n\nexport function renderInternal<T>(component: React.ReactElement<T>, options?: RenderOptions) {\n const { wrapper: Wrapper } = options || {};\n\n // TODO allow passing some options\n const rendererOptions: RootOptions = {};\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n const renderer = renderWithAct(wrap(component), rendererOptions);\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: Root,\n wrap: (element: React.ReactElement) => React.JSX.Element,\n) {\n const rerender = (component: React.ReactElement) => {\n void act(() => {\n renderer.render(wrap(component));\n });\n };\n const rerenderAsync = async (component: React.ReactElement) => {\n // eslint-disable-next-line require-await\n await act(async () => {\n renderer.render(wrap(component));\n });\n };\n\n const unmount = () => {\n void act(() => {\n renderer.unmount();\n });\n };\n const unmountAsync = async () => {\n // eslint-disable-next-line require-await\n await act(async () => {\n renderer.unmount();\n });\n };\n\n const toJSON = (): JsonElement | null => {\n const json = renderer.container.toJSON();\n if (json?.children?.length === 0) {\n return null;\n }\n\n if (json?.children?.length === 1 && typeof json.children[0] !== 'string') {\n return json.children[0];\n }\n\n return json;\n };\n\n addToCleanupQueue(unmountAsync);\n\n const result = {\n ...getQueriesForElement(renderer.container),\n rerender,\n rerenderAsync,\n update: rerender, // alias for 'rerender'\n updateAsync: rerenderAsync, // alias for `rerenderAsync`\n unmount,\n unmountAsync,\n toJSON,\n debug: makeDebug(renderer),\n get container(): HostElement {\n return renderer.container;\n },\n get root(): HostElement | null {\n const firstChild = renderer.container.children[0];\n if (typeof firstChild === 'string') {\n throw new Error(\n 'Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.',\n );\n }\n\n return firstChild;\n },\n };\n\n setRenderResult(result);\n\n return result;\n}\n\nexport type DebugFunction = (options?: DebugOptions) => void;\n\nfunction makeDebug(renderer: Root): DebugFunction {\n function debugImpl(options?: DebugOptions) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions = { ...defaultDebugOptions, ...options };\n const json = renderer.container.toJSON();\n if (json) {\n return debug(json, debugOptions);\n }\n }\n return debugImpl;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAAgD,SAAAE,uBAAAO,CAA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AACU,SAAS,CAACF,MAAM,CAAC,CAAC;IACxC,IAAIC,IAAI,EAAE;MACR,OAAO,IAAAS,YAAK,EAACT,IAAI,EAAEkB,YAAY,CAAC;IAClC;EACF;EACA,OAAOH,SAAS;AAClB","ignoreList":[]}
1
+ {"version":3,"file":"render.js","names":["React","_interopRequireWildcard","require","_testRenderer","_act","_cleanup","_config","_debug","_hostComponentNames","_screen","_within","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","render","element","options","wrapper","Wrapper","createNodeMock","rendererOptions","textComponentTypes","HOST_TEXT_NAMES","publicTextComponentTypes","wrap","createElement","renderer","createRoot","act","container","rerender","component","unmount","toJSON","json","children","length","addToCleanupQueue","result","getQueriesForElement","debug","makeDebug","root","firstChild","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions"],"sources":["../src/render.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n createRoot,\n type HostElement,\n type JsonElement,\n type Root,\n type RootOptions,\n} from 'test-renderer';\n\nimport { act } from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport type { DebugOptions } from './helpers/debug';\nimport { debug } from './helpers/debug';\nimport { HOST_TEXT_NAMES } from './helpers/host-component-names';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n wrapper?: React.ComponentType<any>;\n\n createNodeMock?: (element: React.ReactElement) => object;\n}\n\nexport type RenderResult = Awaited<ReturnType<typeof render>>;\n\n/**\n * Renders test component deeply using React Test Renderer and exposes helpers\n * to assert on the output.\n */\nexport async function render<T>(element: React.ReactElement<T>, options: RenderOptions = {}) {\n const { wrapper: Wrapper, createNodeMock } = options || {};\n\n const rendererOptions: RootOptions = {\n textComponentTypes: HOST_TEXT_NAMES,\n publicTextComponentTypes: ['Text'],\n createNodeMock,\n };\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n const renderer = createRoot(rendererOptions);\n\n await act(() => {\n renderer.render(wrap(element));\n });\n\n const container = renderer.container;\n\n const rerender = async (component: React.ReactElement) => {\n await act(() => {\n renderer.render(wrap(component));\n });\n };\n\n const unmount = async () => {\n await act(() => {\n renderer.unmount();\n });\n };\n\n const toJSON = (): JsonElement | null => {\n const json = renderer.container.toJSON();\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n if (json?.children!.length === 0) {\n return null;\n }\n\n if (json?.children?.length === 1 && typeof json.children[0] !== 'string') {\n return json.children[0];\n }\n\n return json;\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(renderer.container),\n rerender,\n unmount,\n toJSON,\n debug: makeDebug(renderer),\n get container(): HostElement {\n return renderer.container;\n },\n get root(): HostElement | null {\n const firstChild = container.children[0];\n if (typeof firstChild === 'string') {\n /* istanbul ignore next */\n throw new Error(\n 'Invariant Violation: Root element must be a host element. Detected attempt to render a string within the root element.',\n );\n }\n\n return firstChild;\n },\n };\n\n setRenderResult(result);\n\n return result;\n}\n\nexport type DebugFunction = (options?: DebugOptions) => void;\n\nfunction makeDebug(renderer: Root): DebugFunction {\n function debugImpl(options?: DebugOptions) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions = { ...defaultDebugOptions, ...options };\n const json = renderer.container.toJSON();\n if (json) {\n return debug(json, debugOptions);\n }\n }\n return debugImpl;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAQA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GA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MAAMM,MAAM,GAAG;IACb,GAAG,IAAAC,4BAAoB,EAACb,QAAQ,CAACG,SAAS,CAAC;IAC3CC,QAAQ;IACRE,OAAO;IACPC,MAAM;IACNO,KAAK,EAAEC,SAAS,CAACf,QAAQ,CAAC;IAC1B,IAAIG,SAASA,CAAA,EAAgB;MAC3B,OAAOH,QAAQ,CAACG,SAAS;IAC3B,CAAC;IACD,IAAIa,IAAIA,CAAA,EAAuB;MAC7B,MAAMC,UAAU,GAAGd,SAAS,CAACM,QAAQ,CAAC,CAAC,CAAC;MACxC,IAAI,OAAOQ,UAAU,KAAK,QAAQ,EAAE;QAClC;QACA,MAAM,IAAIC,KAAK,CACb,wHACF,CAAC;MACH;MAEA,OAAOD,UAAU;IACnB;EACF,CAAC;EAED,IAAAE,uBAAe,EAACP,MAAM,CAAC;EAEvB,OAAOA,MAAM;AACf;AAIA,SAASG,SAASA,CAACf,QAAc,EAAiB;EAChD,SAASoB,SAASA,CAAC9B,OAAsB,EAAE;IACzC,MAAM;MAAE+B;IAAoB,CAAC,GAAG,IAAAC,iBAAS,EAAC,CAAC;IAC3C,MAAMC,YAAY,GAAG;MAAE,GAAGF,mBAAmB;MAAE,GAAG/B;IAAQ,CAAC;IAC3D,MAAMkB,IAAI,GAAGR,QAAQ,CAACG,SAAS,CAACI,MAAM,CAAC,CAAC;IACxC,IAAIC,IAAI,EAAE;MACR,OAAO,IAAAM,YAAK,EAACN,IAAI,EAAEe,YAAY,CAAC;IAClC;EACF;EACA,OAAOH,SAAS;AAClB","ignoreList":[]}
package/build/screen.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.clearRenderResult = clearRenderResult;
7
7
  exports.screen = void 0;
8
8
  exports.setRenderResult = setRenderResult;
9
- const SCREEN_ERROR = '`render` method has not been called';
9
+ const SCREEN_ERROR = '`render` function has not been called';
10
10
  const notImplemented = () => {
11
11
  throw new Error(SCREEN_ERROR);
12
12
  };
@@ -20,11 +20,7 @@ const defaultScreen = {
20
20
  },
21
21
  debug: notImplemented,
22
22
  rerender: notImplemented,
23
- rerenderAsync: notImplemented,
24
- update: notImplemented,
25
- updateAsync: notImplemented,
26
23
  unmount: notImplemented,
27
- unmountAsync: notImplemented,
28
24
  toJSON: notImplemented,
29
25
  getByLabelText: notImplemented,
30
26
  getAllByLabelText: notImplemented,
@@ -1 +1 @@
1
- {"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","defaultScreen","isDetached","container","root","debug","rerender","rerenderAsync","update","updateAsync","unmount","unmountAsync","toJSON","getByLabelText","getAllByLabelText","queryByLabelText","queryAllByLabelText","findByLabelText","findAllByLabelText","getByHintText","getAllByHintText","queryByHintText","queryAllByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint","getByRole","getAllByRole","queryByRole","queryAllByRole","findByRole","findAllByRole","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","queryAllByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","queryAllByDisplayValue","findByDisplayValue","findAllByDisplayValue","getByTestId","getAllByTestId","queryByTestId","queryAllByTestId","findByTestId","findAllByTestId","getByText","getAllByText","queryByText","queryAllByText","findByText","findAllByText","screen","exports","setRenderResult","renderResult","clearRenderResult"],"sources":["../src/screen.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport type { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` method has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\ninterface Screen extends RenderResult {\n isDetached?: boolean;\n}\n\nconst defaultScreen: Screen = {\n isDetached: true,\n get container(): HostElement {\n throw new Error(SCREEN_ERROR);\n },\n get root(): HostElement | null {\n throw new Error(SCREEN_ERROR);\n },\n debug: notImplemented,\n rerender: notImplemented,\n rerenderAsync: notImplemented,\n update: notImplemented,\n updateAsync: notImplemented,\n unmount: notImplemented,\n unmountAsync: notImplemented,\n toJSON: notImplemented,\n getByLabelText: notImplemented,\n getAllByLabelText: notImplemented,\n queryByLabelText: notImplemented,\n queryAllByLabelText: notImplemented,\n findByLabelText: notImplemented,\n findAllByLabelText: notImplemented,\n getByHintText: notImplemented,\n getAllByHintText: notImplemented,\n queryByHintText: notImplemented,\n queryAllByHintText: notImplemented,\n findByHintText: notImplemented,\n findAllByHintText: notImplemented,\n getByA11yHint: notImplemented,\n getAllByA11yHint: notImplemented,\n queryByA11yHint: notImplemented,\n queryAllByA11yHint: notImplemented,\n findByA11yHint: notImplemented,\n findAllByA11yHint: notImplemented,\n getByAccessibilityHint: notImplemented,\n getAllByAccessibilityHint: notImplemented,\n queryByAccessibilityHint: notImplemented,\n queryAllByAccessibilityHint: notImplemented,\n findByAccessibilityHint: notImplemented,\n findAllByAccessibilityHint: notImplemented,\n getByRole: notImplemented,\n getAllByRole: notImplemented,\n queryByRole: notImplemented,\n queryAllByRole: notImplemented,\n findByRole: notImplemented,\n findAllByRole: notImplemented,\n getByPlaceholderText: notImplemented,\n getAllByPlaceholderText: notImplemented,\n queryByPlaceholderText: notImplemented,\n queryAllByPlaceholderText: notImplemented,\n findByPlaceholderText: notImplemented,\n findAllByPlaceholderText: notImplemented,\n getByDisplayValue: notImplemented,\n getAllByDisplayValue: notImplemented,\n queryByDisplayValue: notImplemented,\n queryAllByDisplayValue: notImplemented,\n findByDisplayValue: notImplemented,\n findAllByDisplayValue: notImplemented,\n getByTestId: notImplemented,\n getAllByTestId: notImplemented,\n queryByTestId: notImplemented,\n queryAllByTestId: notImplemented,\n findByTestId: notImplemented,\n findAllByTestId: notImplemented,\n getByText: notImplemented,\n getAllByText: notImplemented,\n queryByText: notImplemented,\n queryAllByText: notImplemented,\n findByText: notImplemented,\n findAllByText: notImplemented,\n};\n\nexport let screen: Screen = defaultScreen;\n\nexport function setRenderResult(renderResult: RenderResult) {\n screen = renderResult;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"mappings":";;;;;;;;AAIA,MAAMA,YAAY,GAAG,qCAAqC;AAE1D,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC3B,MAAM,IAAIC,KAAK,CAACF,YAAY,CAAC;AAC/B,CAAC;AAMD,MAAMG,aAAqB,GAAG;EAC5BC,UAAU,EAAE,IAAI;EAChB,IAAIC,SAASA,CAAA,EAAgB;IAC3B,MAAM,IAAIH,KAAK,CAACF,YAAY,CAAC;EAC/B,CAAC;EACD,IAAIM,IAAIA,CAAA,EAAuB;IAC7B,MAAM,IAAIJ,KAAK,CAACF,YAAY,CAAC;EAC/B,CAAC;EACDO,KAAK,EAAEN,cAAc;EACrBO,QAAQ,EAAEP,cAAc;EACxBQ,aAAa,EAAER,cAAc;EAC7BS,MAAM,EAAET,cAAc;EACtBU,WAAW,EAAEV,cAAc;EAC3BW,OAAO,EAAEX,cAAc;EACvBY,YAAY,EAAEZ,cAAc;EAC5Ba,MAAM,EAAEb,cAAc;EACtBc,cAAc,EAAEd,cAAc;EAC9Be,iBAAiB,EAAEf,cAAc;EACjCgB,gBAAgB,EAAEhB,cAAc;EAChCiB,mBAAmB,EAAEjB,cAAc;EACnCkB,eAAe,EAAElB,cAAc;EAC/BmB,kBAAkB,EAAEnB,cAAc;EAClCoB,aAAa,EAAEpB,cAAc;EAC7BqB,gBAAgB,EAAErB,cAAc;EAChCsB,eAAe,EAAEtB,cAAc;EAC/BuB,kBAAkB,EAAEvB,cAAc;EAClCwB,cAAc,EAAExB,cAAc;EAC9ByB,iBAAiB,EAAEzB,cAAc;EACjC0B,aAAa,EAAE1B,cAAc;EAC7B2B,gBAAgB,EAAE3B,cAAc;EAChC4B,eAAe,EAAE5B,cAAc;EAC/B6B,kBAAkB,EAAE7B,cAAc;EAClC8B,cAAc,EAAE9B,cAAc;EAC9B+B,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F,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGG,YAAY;AACvB;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClCH,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGlE,aAAa;AACxB","ignoreList":[]}
1
+ {"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","defaultScreen","isDetached","container","root","debug","rerender","unmount","toJSON","getByLabelText","getAllByLabelText","queryByLabelText","queryAllByLabelText","findByLabelText","findAllByLabelText","getByHintText","getAllByHintText","queryByHintText","queryAllByHintText","findByHintText","findAllByHintText","getByA11yHint","getAllByA11yHint","queryByA11yHint","queryAllByA11yHint","findByA11yHint","findAllByA11yHint","getByAccessibilityHint","getAllByAccessibilityHint","queryByAccessibilityHint","queryAllByAccessibilityHint","findByAccessibilityHint","findAllByAccessibilityHint","getByRole","getAllByRole","queryByRole","queryAllByRole","findByRole","findAllByRole","getByPlaceholderText","getAllByPlaceholderText","queryByPlaceholderText","queryAllByPlaceholderText","findByPlaceholderText","findAllByPlaceholderText","getByDisplayValue","getAllByDisplayValue","queryByDisplayValue","queryAllByDisplayValue","findByDisplayValue","findAllByDisplayValue","getByTestId","getAllByTestId","queryByTestId","queryAllByTestId","findByTestId","findAllByTestId","getByText","getAllByText","queryByText","queryAllByText","findByText","findAllByText","screen","exports","setRenderResult","renderResult","clearRenderResult"],"sources":["../src/screen.ts"],"sourcesContent":["import type { HostElement } from 'test-renderer';\n\nimport type { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` function has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\ninterface Screen extends RenderResult {\n isDetached?: boolean;\n}\n\nconst defaultScreen: Screen = {\n isDetached: true,\n get container(): HostElement {\n throw new Error(SCREEN_ERROR);\n },\n get root(): HostElement | null {\n throw new Error(SCREEN_ERROR);\n },\n debug: notImplemented,\n rerender: notImplemented,\n unmount: notImplemented,\n toJSON: notImplemented,\n getByLabelText: notImplemented,\n getAllByLabelText: notImplemented,\n queryByLabelText: notImplemented,\n queryAllByLabelText: notImplemented,\n findByLabelText: notImplemented,\n findAllByLabelText: notImplemented,\n getByHintText: notImplemented,\n getAllByHintText: notImplemented,\n queryByHintText: notImplemented,\n queryAllByHintText: notImplemented,\n findByHintText: notImplemented,\n findAllByHintText: notImplemented,\n getByA11yHint: notImplemented,\n getAllByA11yHint: notImplemented,\n queryByA11yHint: notImplemented,\n queryAllByA11yHint: notImplemented,\n findByA11yHint: notImplemented,\n findAllByA11yHint: notImplemented,\n getByAccessibilityHint: notImplemented,\n getAllByAccessibilityHint: notImplemented,\n queryByAccessibilityHint: notImplemented,\n queryAllByAccessibilityHint: notImplemented,\n findByAccessibilityHint: notImplemented,\n findAllByAccessibilityHint: notImplemented,\n getByRole: notImplemented,\n getAllByRole: notImplemented,\n queryByRole: notImplemented,\n queryAllByRole: notImplemented,\n findByRole: notImplemented,\n findAllByRole: notImplemented,\n getByPlaceholderText: notImplemented,\n getAllByPlaceholderText: notImplemented,\n queryByPlaceholderText: notImplemented,\n queryAllByPlaceholderText: notImplemented,\n findByPlaceholderText: notImplemented,\n findAllByPlaceholderText: notImplemented,\n getByDisplayValue: notImplemented,\n getAllByDisplayValue: notImplemented,\n queryByDisplayValue: notImplemented,\n queryAllByDisplayValue: notImplemented,\n findByDisplayValue: notImplemented,\n findAllByDisplayValue: notImplemented,\n getByTestId: notImplemented,\n getAllByTestId: notImplemented,\n queryByTestId: notImplemented,\n queryAllByTestId: notImplemented,\n findByTestId: notImplemented,\n findAllByTestId: notImplemented,\n getByText: notImplemented,\n getAllByText: notImplemented,\n queryByText: notImplemented,\n queryAllByText: notImplemented,\n findByText: notImplemented,\n findAllByText: notImplemented,\n};\n\nexport let screen: Screen = defaultScreen;\n\nexport function setRenderResult(renderResult: RenderResult) {\n screen = renderResult;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"mappings":";;;;;;;;AAIA,MAAMA,YAAY,GAAG,uCAAuC;AAE5D,MA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C,cAAc;EAC3BqC,cAAc,EAAErC,cAAc;EAC9BsC,UAAU,EAAEtC,cAAc;EAC1BuC,aAAa,EAAEvC,cAAc;EAC7BwC,oBAAoB,EAAExC,cAAc;EACpCyC,uBAAuB,EAAEzC,cAAc;EACvC0C,sBAAsB,EAAE1C,cAAc;EACtC2C,yBAAyB,EAAE3C,cAAc;EACzC4C,qBAAqB,EAAE5C,cAAc;EACrC6C,wBAAwB,EAAE7C,cAAc;EACxC8C,iBAAiB,EAAE9C,cAAc;EACjC+C,oBAAoB,EAAE/C,cAAc;EACpCgD,mBAAmB,EAAEhD,cAAc;EACnCiD,sBAAsB,EAAEjD,cAAc;EACtCkD,kBAAkB,EAAElD,cAAc;EAClCmD,qBAAqB,EAAEnD,cAAc;EACrCoD,WAAW,EAAEpD,cAAc;EAC3BqD,cAAc,EAAErD,cAAc;EAC9BsD,aAAa,EAAEtD,cAAc;EAC7BuD,gBAAgB,EAAEvD,cAAc;EAChCwD,YAAY,EAAExD,cAAc;EAC5ByD,eAAe,EAAEzD,cAAc;EAC/B0D,SAAS,EAAE1D,cAAc;EACzB2D,YAAY,EAAE3D,cAAc;EAC5B4D,WAAW,EAAE5D,cAAc;EAC3B6D,cAAc,EAAE7D,cAAc;EAC9B8D,UAAU,EAAE9D,cAAc;EAC1B+D,aAAa,EAAE/D;AACjB,CAAC;AAEM,IAAIgE,MAAc,GAAAC,OAAA,CAAAD,MAAA,GAAG9D,aAAa;AAElC,SAASgE,eAAeA,CAACC,YAA0B,EAAE;EAC1DF,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGG,YAAY;AACvB;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClCH,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAG9D,aAAa;AACxB","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { JsonNode } from 'universal-test-renderer';
1
+ import type { JsonNode } from 'test-renderer';
2
2
  type JsonPropsMapper = {
3
3
  [key: string]: unknown;
4
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"json.js","names":["mapJsonProps","node","mapper","Array","isArray","map","e","resultProps","props","Object","keys","forEach","key","resultElement","defineProperty","value","Symbol","for"],"sources":["../../src/test-utils/json.ts"],"sourcesContent":["import type { JsonNode } from 'universal-test-renderer';\n\ntype JsonPropsMapper = {\n [key: string]: unknown;\n};\n\nexport function mapJsonProps<T extends JsonNode | JsonNode[] | null>(\n node: T,\n mapper: JsonPropsMapper,\n): T {\n if (Array.isArray(node)) {\n return node.map((e) => mapJsonProps(e, mapper)) as T;\n }\n\n if (!node || typeof node === 'string') {\n return node;\n }\n\n const resultProps: Record<string, unknown> = { ...node.props };\n Object.keys(mapper).forEach((key) => {\n if (key in node.props) {\n resultProps[key] = mapper[key];\n }\n });\n\n // @ts-expect-error: TODO fix type\n const resultElement = { ...node, props: resultProps };\n Object.defineProperty(resultElement, '$$typeof', {\n value: Symbol.for('react.test.json'),\n });\n\n return resultElement;\n}\n"],"mappings":";;;;;;AAMO,SAASA,YAAYA,CAC1BC,IAAO,EACPC,MAAuB,EACpB;EACH,IAAIC,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,EAAE;IACvB,OAAOA,IAAI,CAACI,GAAG,CAAEC,CAAC,IAAKN,YAAY,CAACM,CAAC,EAAEJ,MAAM,CAAC,CAAC;EACjD;EAEA,IAAI,CAACD,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACrC,OAAOA,IAAI;EACb;EAEA,MAAMM,WAAoC,GAAG;IAAE,GAAGN,IAAI,CAACO;EAAM,CAAC;EAC9DC,MAAM,CAACC,IAAI,CAACR,MAAM,CAAC,CAACS,OAAO,CAAEC,GAAG,IAAK;IACnC,IAAIA,GAAG,IAAIX,IAAI,CAACO,KAAK,EAAE;MACrBD,WAAW,CAACK,GAAG,CAAC,GAAGV,MAAM,CAACU,GAAG,CAAC;IAChC;EACF,CAAC,CAAC;;EAEF;EACA,MAAMC,aAAa,GAAG;IAAE,GAAGZ,IAAI;IAAEO,KAAK,EAAED;EAAY,CAAC;EACrDE,MAAM,CAACK,cAAc,CAACD,aAAa,EAAE,UAAU,EAAE;IAC/CE,KAAK,EAAEC,MAAM,CAACC,GAAG,CAAC,iBAAiB;EACrC,CAAC,CAAC;EAEF,OAAOJ,aAAa;AACtB","ignoreList":[]}
1
+ {"version":3,"file":"json.js","names":["mapJsonProps","node","mapper","Array","isArray","map","e","resultProps","props","Object","keys","forEach","key","resultElement","defineProperty","value","Symbol","for"],"sources":["../../src/test-utils/json.ts"],"sourcesContent":["import type { JsonNode } from 'test-renderer';\n\ntype JsonPropsMapper = {\n [key: string]: unknown;\n};\n\nexport function mapJsonProps<T extends JsonNode | JsonNode[] | null>(\n node: T,\n mapper: JsonPropsMapper,\n): T {\n if (Array.isArray(node)) {\n return node.map((e) => mapJsonProps(e, mapper)) as T;\n }\n\n if (!node || typeof node === 'string') {\n return node;\n }\n\n const resultProps: Record<string, unknown> = { ...node.props };\n Object.keys(mapper).forEach((key) => {\n if (key in node.props) {\n resultProps[key] = mapper[key];\n }\n });\n\n // @ts-expect-error: TODO fix type\n const resultElement = { ...node, props: resultProps };\n Object.defineProperty(resultElement, '$$typeof', {\n value: Symbol.for('react.test.json'),\n });\n\n return resultElement;\n}\n"],"mappings":";;;;;;AAMO,SAASA,YAAYA,CAC1BC,IAAO,EACPC,MAAuB,EACpB;EACH,IAAIC,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,EAAE;IACvB,OAAOA,IAAI,CAACI,GAAG,CAAEC,CAAC,IAAKN,YAAY,CAACM,CAAC,EAAEJ,MAAM,CAAC,CAAC;EACjD;EAEA,IAAI,CAACD,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACrC,OAAOA,IAAI;EACb;EAEA,MAAMM,WAAoC,GAAG;IAAE,GAAGN,IAAI,CAACO;EAAM,CAAC;EAC9DC,MAAM,CAACC,IAAI,CAACR,MAAM,CAAC,CAACS,OAAO,CAAEC,GAAG,IAAK;IACnC,IAAIA,GAAG,IAAIX,IAAI,CAACO,KAAK,EAAE;MACrBD,WAAW,CAACK,GAAG,CAAC,GAAGV,MAAM,CAACU,GAAG,CAAC;IAChC;EACF,CAAC,CAAC;;EAEF;EACA,MAAMC,aAAa,GAAG;IAAE,GAAGZ,IAAI;IAAEO,KAAK,EAAED;EAAY,CAAC;EACrDE,MAAM,CAACK,cAAc,CAACD,aAAa,EAAE,UAAU,EAAE;IAC/CE,KAAK,EAAEC,MAAM,CAACC,GAAG,CAAC,iBAAiB;EACrC,CAAC,CAAC;EAEF,OAAOJ,aAAa;AACtB","ignoreList":[]}
@@ -1 +1 @@
1
- {"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/event-handler.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-act.ts","../src/render-async.tsx","../src/render-hook.tsx","../src/render.tsx","../src/screen.ts","../src/types.ts","../src/wait-for-element-to-be-removed.ts","../src/wait-for.ts","../src/within.ts","../src/helpers/accessibility.ts","../src/helpers/component-tree.ts","../src/helpers/debug.ts","../src/helpers/errors.ts","../src/helpers/find-all.ts","../src/helpers/format-element.ts","../src/helpers/host-component-names.ts","../src/helpers/logger.ts","../src/helpers/map-props.ts","../src/helpers/object.ts","../src/helpers/pointer-events.ts","../src/helpers/text-content.ts","../src/helpers/text-input.ts","../src/helpers/timers.ts","../src/helpers/wrap-async.ts","../src/helpers/matchers/match-accessibility-state.ts","../src/helpers/matchers/match-accessibility-value.ts","../src/helpers/matchers/match-array-prop.ts","../src/helpers/matchers/match-label-text.ts","../src/helpers/matchers/match-object-prop.ts","../src/helpers/matchers/match-string-prop.ts","../src/helpers/matchers/match-text-content.ts","../src/matchers/extend-expect.ts","../src/matchers/index.ts","../src/matchers/to-be-busy.ts","../src/matchers/to-be-checked.ts","../src/matchers/to-be-disabled.ts","../src/matchers/to-be-empty-element.ts","../src/matchers/to-be-expanded.ts","../src/matchers/to-be-on-the-screen.ts","../src/matchers/to-be-partially-checked.ts","../src/matchers/to-be-selected.ts","../src/matchers/to-be-visible.ts","../src/matchers/to-contain-element.ts","../src/matchers/to-have-accessibility-value.ts","../src/matchers/to-have-accessible-name.ts","../src/matchers/to-have-display-value.ts","../src/matchers/to-have-prop.ts","../src/matchers/to-have-style.ts","../src/matchers/to-have-text-content.ts","../src/matchers/types.ts","../src/matchers/utils.ts","../src/queries/display-value.ts","../src/queries/hint-text.ts","../src/queries/label-text.ts","../src/queries/make-queries.ts","../src/queries/options.ts","../src/queries/placeholder-text.ts","../src/queries/role.ts","../src/queries/test-id.ts","../src/queries/text.ts","../src/test-utils/console.ts","../src/test-utils/events.ts","../src/test-utils/json.ts","../src/test-utils/version.ts","../src/user-event/clear.ts","../src/user-event/index.ts","../src/user-event/paste.ts","../src/user-event/event-builder/base.ts","../src/user-event/event-builder/common.ts","../src/user-event/event-builder/index.ts","../src/user-event/event-builder/scroll-view.ts","../src/user-event/event-builder/text-input.ts","../src/user-event/press/index.ts","../src/user-event/press/press.ts","../src/user-event/scroll/index.ts","../src/user-event/scroll/scroll-to.ts","../src/user-event/scroll/utils.ts","../src/user-event/setup/index.ts","../src/user-event/setup/setup.ts","../src/user-event/type/index.ts","../src/user-event/type/parse-keys.ts","../src/user-event/type/type.ts","../src/user-event/utils/content-size.ts","../src/user-event/utils/dispatch-event.ts","../src/user-event/utils/index.ts","../src/user-event/utils/text-range.ts","../src/user-event/utils/wait.ts"],"version":"5.9.3"}
1
+ {"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/event-handler.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-hook.tsx","../src/render.tsx","../src/screen.ts","../src/types.ts","../src/wait-for-element-to-be-removed.ts","../src/wait-for.ts","../src/within.ts","../src/helpers/accessibility.ts","../src/helpers/component-tree.ts","../src/helpers/debug.ts","../src/helpers/errors.ts","../src/helpers/find-all.ts","../src/helpers/format-element.ts","../src/helpers/host-component-names.ts","../src/helpers/logger.ts","../src/helpers/map-props.ts","../src/helpers/object.ts","../src/helpers/pointer-events.ts","../src/helpers/text-content.ts","../src/helpers/text-input.ts","../src/helpers/timers.ts","../src/helpers/wrap-async.ts","../src/helpers/matchers/match-accessibility-state.ts","../src/helpers/matchers/match-accessibility-value.ts","../src/helpers/matchers/match-array-prop.ts","../src/helpers/matchers/match-label-text.ts","../src/helpers/matchers/match-object-prop.ts","../src/helpers/matchers/match-string-prop.ts","../src/helpers/matchers/match-text-content.ts","../src/matchers/extend-expect.ts","../src/matchers/index.ts","../src/matchers/to-be-busy.ts","../src/matchers/to-be-checked.ts","../src/matchers/to-be-disabled.ts","../src/matchers/to-be-empty-element.ts","../src/matchers/to-be-expanded.ts","../src/matchers/to-be-on-the-screen.ts","../src/matchers/to-be-partially-checked.ts","../src/matchers/to-be-selected.ts","../src/matchers/to-be-visible.ts","../src/matchers/to-contain-element.ts","../src/matchers/to-have-accessibility-value.ts","../src/matchers/to-have-accessible-name.ts","../src/matchers/to-have-display-value.ts","../src/matchers/to-have-prop.ts","../src/matchers/to-have-style.ts","../src/matchers/to-have-text-content.ts","../src/matchers/types.ts","../src/matchers/utils.ts","../src/queries/display-value.ts","../src/queries/hint-text.ts","../src/queries/label-text.ts","../src/queries/make-queries.ts","../src/queries/options.ts","../src/queries/placeholder-text.ts","../src/queries/role.ts","../src/queries/test-id.ts","../src/queries/text.ts","../src/test-utils/console.ts","../src/test-utils/events.ts","../src/test-utils/json.ts","../src/test-utils/version.ts","../src/user-event/clear.ts","../src/user-event/index.ts","../src/user-event/paste.ts","../src/user-event/event-builder/base.ts","../src/user-event/event-builder/common.ts","../src/user-event/event-builder/index.ts","../src/user-event/event-builder/scroll-view.ts","../src/user-event/event-builder/text-input.ts","../src/user-event/press/index.ts","../src/user-event/press/press.ts","../src/user-event/scroll/index.ts","../src/user-event/scroll/scroll-to.ts","../src/user-event/scroll/utils.ts","../src/user-event/setup/index.ts","../src/user-event/setup/setup.ts","../src/user-event/type/index.ts","../src/user-event/type/parse-keys.ts","../src/user-event/type/type.ts","../src/user-event/utils/content-size.ts","../src/user-event/utils/dispatch-event.ts","../src/user-event/utils/index.ts","../src/user-event/utils/text-range.ts","../src/user-event/utils/wait.ts"],"version":"5.9.3"}
package/build/types.js CHANGED
@@ -1,2 +1,6 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
2
6
  //# sourceMappingURL=types.js.map
@@ -1,3 +1,3 @@
1
- import type { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'test-renderer';
2
2
  import type { UserEventInstance } from './setup';
3
3
  export declare function clear(this: UserEventInstance, element: HostElement): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"clear.js","names":["_errors","require","_hostComponentNames","_pointerEvents","_textInput","_eventBuilder","_type","_utils","clear","element","isHostTextInput","ErrorWithStack","type","isEditableTextInput","isPointerEventEnabled","dispatchEvent","EventBuilder","Common","focus","textToClear","getTextInputValue","selectionRange","start","end","length","TextInput","selectionChange","emptyText","emitTypingEvents","config","key","text","wait","endEditing","blur"],"sources":["../../src/user-event/clear.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { isPointerEventEnabled } from '../helpers/pointer-events';\nimport { getTextInputValue, isEditableTextInput } from '../helpers/text-input';\nimport { EventBuilder } from './event-builder';\nimport type { UserEventInstance } from './setup';\nimport { emitTypingEvents } from './type/type';\nimport { dispatchEvent, wait } from './utils';\n\nexport async function clear(this: UserEventInstance, element: HostElement): Promise<void> {\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `clear() only supports host \"TextInput\" elements. Passed element has type: \"${element.type}\".`,\n clear,\n );\n }\n\n if (!isEditableTextInput(element) || !isPointerEventEnabled(element)) {\n return;\n }\n\n // 1. Enter element\n await dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n // 2. Select all\n const textToClear = getTextInputValue(element);\n const selectionRange = {\n start: 0,\n end: textToClear.length,\n };\n await dispatchEvent(\n element,\n 'selectionChange',\n EventBuilder.TextInput.selectionChange(selectionRange),\n );\n\n // 3. Press backspace with selected text\n const emptyText = '';\n await emitTypingEvents(element, {\n config: this.config,\n key: 'Backspace',\n text: emptyText,\n });\n\n // 4. Exit element\n await wait(this.config);\n await dispatchEvent(element, 'endEditing', EventBuilder.TextInput.endEditing(emptyText));\n await dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEO,eAAeO,KAAKA,CAA0BC,OAAoB,EAAiB;EACxF,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIE,sBAAc,CACtB,8EAA8EF,OAAO,CAACG,IAAI,IAAI,EAC9FJ,KACF,CAAC;EACH;EAEA,IAAI,CAAC,IAAAK,8BAAmB,EAACJ,OAAO,CAAC,IAAI,CAAC,IAAAK,oCAAqB,EAACL,OAAO,CAAC,EAAE;IACpE;EACF;;EAEA;EACA,MAAM,IAAAM,oBAAa,EAACN,OAAO,EAAE,OAAO,EAAEO,0BAAY,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;;EAElE;EACA,MAAMC,WAAW,GAAG,IAAAC,4BAAiB,EAACX,OAAO,CAAC;EAC9C,MAAMY,cAAc,GAAG;IACrBC,KAAK,EAAE,CAAC;IACRC,GAAG,EAAEJ,WAAW,CAACK;EACnB,CAAC;EACD,MAAM,IAAAT,oBAAa,EACjBN,OAAO,EACP,iBAAiB,EACjBO,0BAAY,CAACS,SAAS,CAACC,eAAe,CAACL,cAAc,CACvD,CAAC;;EAED;EACA,MAAMM,SAAS,GAAG,EAAE;EACpB,MAAM,IAAAC,sBAAgB,EAACnB,OAAO,EAAE;IAC9BoB,MAAM,EAAE,IAAI,CAACA,MAAM;IACnBC,GAAG,EAAE,WAAW;IAChBC,IAAI,EAAEJ;EACR,CAAC,CAAC;;EAEF;EACA,MAAM,IAAAK,WAAI,EAAC,IAAI,CAACH,MAAM,CAAC;EACvB,MAAM,IAAAd,oBAAa,EAACN,OAAO,EAAE,YAAY,EAAEO,0BAAY,CAACS,SAAS,CAACQ,UAAU,CAACN,SAAS,CAAC,CAAC;EACxF,MAAM,IAAAZ,oBAAa,EAACN,OAAO,EAAE,MAAM,EAAEO,0BAAY,CAACC,MAAM,CAACiB,IAAI,CAAC,CAAC,CAAC;AAClE","ignoreList":[]}
1
+ {"version":3,"file":"clear.js","names":["_errors","require","_hostComponentNames","_pointerEvents","_textInput","_eventBuilder","_type","_utils","clear","element","isHostTextInput","ErrorWithStack","type","isEditableTextInput","isPointerEventEnabled","dispatchEvent","EventBuilder","Common","focus","textToClear","getTextInputValue","selectionRange","start","end","length","TextInput","selectionChange","emptyText","emitTypingEvents","config","key","text","wait","endEditing","blur"],"sources":["../../src/user-event/clear.ts"],"sourcesContent":["import type { HostElement } from 'test-renderer';\n\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { isPointerEventEnabled } from '../helpers/pointer-events';\nimport { getTextInputValue, isEditableTextInput } from '../helpers/text-input';\nimport { EventBuilder } from './event-builder';\nimport type { UserEventInstance } from './setup';\nimport { emitTypingEvents } from './type/type';\nimport { dispatchEvent, wait } from './utils';\n\nexport async function clear(this: UserEventInstance, element: HostElement): Promise<void> {\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `clear() only supports host \"TextInput\" elements. Passed element has type: \"${element.type}\".`,\n clear,\n );\n }\n\n if (!isEditableTextInput(element) || !isPointerEventEnabled(element)) {\n return;\n }\n\n // 1. Enter element\n await dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n // 2. Select all\n const textToClear = getTextInputValue(element);\n const selectionRange = {\n start: 0,\n end: textToClear.length,\n };\n await dispatchEvent(\n element,\n 'selectionChange',\n EventBuilder.TextInput.selectionChange(selectionRange),\n );\n\n // 3. Press backspace with selected text\n const emptyText = '';\n await emitTypingEvents(element, {\n config: this.config,\n key: 'Backspace',\n text: emptyText,\n });\n\n // 4. Exit element\n await wait(this.config);\n await dispatchEvent(element, 'endEditing', EventBuilder.TextInput.endEditing(emptyText));\n await dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAEA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEO,eAAeO,KAAKA,CAA0BC,OAAoB,EAAiB;EACxF,IAAI,CAAC,IAAAC,mCAAe,EAACD,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAIE,sBAAc,CACtB,8EAA8EF,OAAO,CAACG,IAAI,IAAI,EAC9FJ,KACF,CAAC;EACH;EAEA,IAAI,CAAC,IAAAK,8BAAmB,EAACJ,OAAO,CAAC,IAAI,CAAC,IAAAK,oCAAqB,EAACL,OAAO,CAAC,EAAE;IACpE;EACF;;EAEA;EACA,MAAM,IAAAM,oBAAa,EAACN,OAAO,EAAE,OAAO,EAAEO,0BAAY,CAACC,MAAM,CAACC,KAAK,CAAC,CAAC,CAAC;;EAElE;EACA,MAAMC,WAAW,GAAG,IAAAC,4BAAiB,EAACX,OAAO,CAAC;EAC9C,MAAMY,cAAc,GAAG;IACrBC,KAAK,E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