@testing-library/react-native 12.2.2 → 12.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/build/act.js +1 -2
  2. package/build/act.js.map +1 -1
  3. package/build/config.d.ts +2 -0
  4. package/build/config.js.map +1 -1
  5. package/build/fireEvent.js +3 -3
  6. package/build/fireEvent.js.map +1 -1
  7. package/build/helpers/accessiblity.d.ts +11 -0
  8. package/build/helpers/accessiblity.js +108 -8
  9. package/build/helpers/accessiblity.js.map +1 -1
  10. package/build/helpers/component-tree.d.ts +7 -0
  11. package/build/helpers/component-tree.js +18 -0
  12. package/build/helpers/component-tree.js.map +1 -1
  13. package/build/helpers/format-default.d.ts +1 -2
  14. package/build/helpers/format-default.js +22 -13
  15. package/build/helpers/format-default.js.map +1 -1
  16. package/build/helpers/format.js +4 -8
  17. package/build/helpers/format.js.map +1 -1
  18. package/build/helpers/host-component-names.d.ts +10 -0
  19. package/build/helpers/host-component-names.js +27 -3
  20. package/build/helpers/host-component-names.js.map +1 -1
  21. package/build/helpers/matchers/accessibilityState.js +3 -3
  22. package/build/helpers/matchers/accessibilityState.js.map +1 -1
  23. package/build/helpers/matchers/accessibilityValue.js +3 -2
  24. package/build/helpers/matchers/accessibilityValue.js.map +1 -1
  25. package/build/helpers/matchers/matchLabelText.d.ts +1 -1
  26. package/build/helpers/matchers/matchLabelText.js +5 -8
  27. package/build/helpers/matchers/matchLabelText.js.map +1 -1
  28. package/build/helpers/matchers/matchTextContent.js +2 -2
  29. package/build/helpers/matchers/matchTextContent.js.map +1 -1
  30. package/build/helpers/object.d.ts +1 -0
  31. package/build/helpers/object.js +16 -0
  32. package/build/helpers/object.js.map +1 -0
  33. package/build/helpers/{getTextContent.js → text-content.js} +1 -1
  34. package/build/helpers/text-content.js.map +1 -0
  35. package/build/helpers/text-input.d.ts +3 -0
  36. package/build/helpers/text-input.js +21 -0
  37. package/build/helpers/text-input.js.map +1 -0
  38. package/build/helpers/wrap-async.d.ts +7 -0
  39. package/build/helpers/wrap-async.js +45 -0
  40. package/build/helpers/wrap-async.js.map +1 -0
  41. package/build/matchers/extend-expect.d.js +2 -0
  42. package/build/matchers/extend-expect.d.js.map +1 -0
  43. package/build/matchers/extend-expect.d.ts +2 -0
  44. package/build/matchers/extend-expect.js +38 -0
  45. package/build/matchers/extend-expect.js.map +1 -0
  46. package/build/matchers/index.d.ts +15 -0
  47. package/build/matchers/index.js +117 -0
  48. package/build/matchers/index.js.map +1 -0
  49. package/build/matchers/to-be-busy.d.ts +6 -0
  50. package/build/matchers/to-be-busy.js +20 -0
  51. package/build/matchers/to-be-busy.js.map +1 -0
  52. package/build/matchers/to-be-checked.d.ts +6 -0
  53. package/build/matchers/to-be-checked.js +31 -0
  54. package/build/matchers/to-be-checked.js.map +1 -0
  55. package/build/matchers/to-be-collapsed.d.ts +6 -0
  56. package/build/matchers/to-be-collapsed.js +20 -0
  57. package/build/matchers/to-be-collapsed.js.map +1 -0
  58. package/build/matchers/to-be-disabled.d.ts +10 -0
  59. package/build/matchers/to-be-disabled.js +52 -0
  60. package/build/matchers/to-be-disabled.js.map +1 -0
  61. package/build/matchers/to-be-empty-element.d.ts +6 -0
  62. package/build/matchers/to-be-empty-element.js +20 -0
  63. package/build/matchers/to-be-empty-element.js.map +1 -0
  64. package/build/matchers/to-be-expanded.d.ts +6 -0
  65. package/build/matchers/to-be-expanded.js +20 -0
  66. package/build/matchers/to-be-expanded.js.map +1 -0
  67. package/build/matchers/to-be-on-the-screen.d.ts +6 -0
  68. package/build/matchers/to-be-on-the-screen.js +29 -0
  69. package/build/matchers/to-be-on-the-screen.js.map +1 -0
  70. package/build/matchers/to-be-partially-checked.d.ts +6 -0
  71. package/build/matchers/to-be-partially-checked.js +28 -0
  72. package/build/matchers/to-be-partially-checked.js.map +1 -0
  73. package/build/matchers/to-be-selected.d.ts +6 -0
  74. package/build/matchers/to-be-selected.js +20 -0
  75. package/build/matchers/to-be-selected.js.map +1 -0
  76. package/build/matchers/to-be-visible.d.ts +6 -0
  77. package/build/matchers/to-be-visible.js +56 -0
  78. package/build/matchers/to-be-visible.js.map +1 -0
  79. package/build/matchers/to-contain-element.d.ts +6 -0
  80. package/build/matchers/to-contain-element.js +26 -0
  81. package/build/matchers/to-contain-element.js.map +1 -0
  82. package/build/matchers/to-have-display-value.d.ts +7 -0
  83. package/build/matchers/to-have-display-value.js +26 -0
  84. package/build/matchers/to-have-display-value.js.map +1 -0
  85. package/build/matchers/to-have-prop.d.ts +6 -0
  86. package/build/matchers/to-have-prop.js +35 -0
  87. package/build/matchers/to-have-prop.js.map +1 -0
  88. package/build/matchers/to-have-style.d.ts +8 -0
  89. package/build/matchers/to-have-style.js +52 -0
  90. package/build/matchers/to-have-style.js.map +1 -0
  91. package/build/matchers/to-have-text-content.d.ts +7 -0
  92. package/build/matchers/to-have-text-content.js +21 -0
  93. package/build/matchers/to-have-text-content.js.map +1 -0
  94. package/build/matchers/utils.d.ts +18 -0
  95. package/build/matchers/utils.js +90 -0
  96. package/build/matchers/utils.js.map +1 -0
  97. package/build/matches.d.ts +1 -1
  98. package/build/matches.js.map +1 -1
  99. package/build/queries/displayValue.js +4 -3
  100. package/build/queries/displayValue.js.map +1 -1
  101. package/build/queries/labelText.js +2 -2
  102. package/build/queries/labelText.js.map +1 -1
  103. package/build/queries/role.js +1 -1
  104. package/build/queries/role.js.map +1 -1
  105. package/build/react-versions.js +2 -2
  106. package/build/react-versions.js.map +1 -1
  107. package/build/render.d.ts +12 -48
  108. package/build/render.js +5 -4
  109. package/build/render.js.map +1 -1
  110. package/build/screen.js +1 -2
  111. package/build/screen.js.map +1 -1
  112. package/build/shallow.js +2 -2
  113. package/build/shallow.js.map +1 -1
  114. package/build/test-utils/events.d.ts +1 -2
  115. package/build/test-utils/events.js.map +1 -1
  116. package/build/user-event/clear.js +2 -1
  117. package/build/user-event/clear.js.map +1 -1
  118. package/build/user-event/event-builder/common.js +1 -2
  119. package/build/user-event/event-builder/common.js.map +1 -1
  120. package/build/user-event/event-builder/index.d.ts +30 -0
  121. package/build/user-event/event-builder/index.js +3 -2
  122. package/build/user-event/event-builder/index.js.map +1 -1
  123. package/build/user-event/event-builder/scroll-view.d.ts +42 -0
  124. package/build/user-event/event-builder/scroll-view.js +52 -0
  125. package/build/user-event/event-builder/scroll-view.js.map +1 -0
  126. package/build/user-event/event-builder/text-input.js +1 -2
  127. package/build/user-event/event-builder/text-input.js.map +1 -1
  128. package/build/user-event/index.d.ts +2 -0
  129. package/build/user-event/index.js +3 -3
  130. package/build/user-event/index.js.map +1 -1
  131. package/build/user-event/press/constants.js +2 -4
  132. package/build/user-event/press/constants.js.map +1 -1
  133. package/build/user-event/press/press.js +11 -14
  134. package/build/user-event/press/press.js.map +1 -1
  135. package/build/user-event/scroll/index.d.ts +1 -0
  136. package/build/user-event/scroll/index.js +19 -0
  137. package/build/user-event/scroll/index.js.map +1 -0
  138. package/build/user-event/scroll/scrollTo.d.ts +16 -0
  139. package/build/user-event/scroll/scrollTo.js +82 -0
  140. package/build/user-event/scroll/scrollTo.js.map +1 -0
  141. package/build/user-event/scroll/state.d.ts +4 -0
  142. package/build/user-event/scroll/state.js +18 -0
  143. package/build/user-event/scroll/state.js.map +1 -0
  144. package/build/user-event/scroll/utils.d.ts +20 -0
  145. package/build/user-event/scroll/utils.js +68 -0
  146. package/build/user-event/scroll/utils.js.map +1 -0
  147. package/build/user-event/setup/setup.d.ts +8 -0
  148. package/build/user-event/setup/setup.js +34 -6
  149. package/build/user-event/setup/setup.js.map +1 -1
  150. package/build/user-event/type/type.js +2 -1
  151. package/build/user-event/type/type.js.map +1 -1
  152. package/build/user-event/utils/index.d.ts +0 -1
  153. package/build/user-event/utils/index.js +0 -11
  154. package/build/user-event/utils/index.js.map +1 -1
  155. package/build/waitFor.js +2 -26
  156. package/build/waitFor.js.map +1 -1
  157. package/build/within.js +1 -2
  158. package/build/within.js.map +1 -1
  159. package/package.json +23 -37
  160. package/build/helpers/getTextContent.js.map +0 -1
  161. package/build/user-event/utils/host-components.d.ts +0 -2
  162. package/build/user-event/utils/host-components.js +0 -11
  163. package/build/user-event/utils/host-components.js.map +0 -1
  164. /package/build/helpers/{getTextContent.d.ts → text-content.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","names":["React","_interopRequireWildcard","require","_act","_interopRequireDefault","_cleanup","_config","_componentTree","_debugDeep","_debugShallow","_hostComponentNames","_stringValidation","_renderAct","_screen","_within","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","render","component","options","renderInternal","wrapper","Wrapper","createNodeMock","unstable_validateStringsRenderedWithinText","detectHostComponentNames","configureHostComponentNamesIfNeeded","renderWithStringValidation","wrap","element","createElement","renderer","renderWithAct","undefined","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","screen","toJSON","Profiler","id","onRender","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","rerender","debug","getHostChildren","UNSAFE_root","enumerable","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions","message","console","warn","json","debugDeep","shallow","debugShallow"],"sources":["../src/render.tsx"],"sourcesContent":["import type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport { Profiler } from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport { getHostChildren } from './helpers/component-tree';\nimport debugDeep, { DebugOptions } from './helpers/debugDeep';\nimport debugShallow from './helpers/debugShallow';\nimport { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';\nimport { validateStringsRenderedWithinText } from './helpers/stringValidation';\nimport { renderWithAct } from './render-act';\nimport { setRenderResult, screen } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n unstable_validateStringsRenderedWithinText?: boolean;\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>(\n component: React.ReactElement<T>,\n options: RenderOptions = {}\n) {\n return renderInternal(component, options);\n}\n\nexport interface RenderInternalOptions extends RenderOptions {\n detectHostComponentNames?: boolean;\n}\n\nexport function renderInternal<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n unstable_validateStringsRenderedWithinText,\n detectHostComponentNames = true,\n }: RenderInternalOptions = {}\n) {\n if (detectHostComponentNames) {\n configureHostComponentNamesIfNeeded();\n }\n\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n createNodeMock,\n });\n }\n\n const wrap = (element: React.ReactElement) =>\n Wrapper ? <Wrapper>{element}</Wrapper> : element;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n }: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {}\n) {\n const handleRender: React.ProfilerProps['onRender'] = (_, phase) => {\n if (phase === 'update') {\n validateStringsRenderedWithinText(screen.toJSON());\n }\n };\n\n const wrap = (element: React.ReactElement) => (\n <Profiler id=\"renderProfiler\" onRender={handleRender}>\n {Wrapper ? <Wrapper>{element}</Wrapper> : element}\n </Profiler>\n );\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n validateStringsRenderedWithinText(renderer.toJSON());\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: ReactTestRenderer,\n wrap: (element: React.ReactElement) => JSX.Element\n) {\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n get root(): ReactTestInstance {\n return getHostChildren(instance)[0];\n },\n UNSAFE_root: instance,\n };\n\n // Add as non-enumerable property, so that it's safe to enumerate\n // `render` result, e.g. using destructuring rest syntax.\n Object.defineProperty(result, 'container', {\n enumerable: false,\n get() {\n throw new Error(\n \"'container' property has been renamed to 'UNSAFE_root'.\\n\\n\" +\n \"Consider using 'root' property which returns root host element.\"\n );\n },\n });\n\n setRenderResult(result);\n return result;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\nexport interface DebugFunction {\n (options?: DebugOptions | string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(options?: DebugOptions | string) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions =\n typeof options === 'string'\n ? { ...defaultDebugOptions, message: options }\n : { ...defaultDebugOptions, ...options };\n\n if (typeof options === 'string') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Using debug(\"message\") is deprecated and will be removed in future release, please use debug({ message; \"message\" }) instead.'\n );\n }\n\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, debugOptions);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AAC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EAAEkB,OAAO,CAAC;EACzE,OAAOJ,SAAS;AAClB"}
1
+ {"version":3,"file":"render.js","names":["_react","_interopRequireWildcard","require","React","_act","_interopRequireDefault","_cleanup","_config","_componentTree","_debugDeep","_debugShallow","_hostComponentNames","_stringValidation","_renderAct","_screen","_within","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","render","component","options","renderInternal","wrapper","Wrapper","createNodeMock","unstable_validateStringsRenderedWithinText","detectHostComponentNames","configureHostComponentNamesIfNeeded","renderWithStringValidation","wrap","element","createElement","renderer","renderWithAct","undefined","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","screen","toJSON","Profiler","id","onRender","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","rerender","debug","getHostChildren","UNSAFE_root","enumerable","Error","setRenderResult","debugImpl","defaultDebugOptions","getConfig","debugOptions","message","console","warn","json","debugDeep","shallow","debugShallow"],"sources":["../src/render.tsx"],"sourcesContent":["import type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport { Profiler } from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport { getConfig } from './config';\nimport { getHostChildren } from './helpers/component-tree';\nimport debugDeep, { DebugOptions } from './helpers/debugDeep';\nimport debugShallow from './helpers/debugShallow';\nimport { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';\nimport { validateStringsRenderedWithinText } from './helpers/stringValidation';\nimport { renderWithAct } from './render-act';\nimport { setRenderResult, screen } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n unstable_validateStringsRenderedWithinText?: boolean;\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>(\n component: React.ReactElement<T>,\n options: RenderOptions = {}\n) {\n return renderInternal(component, options);\n}\n\nexport interface RenderInternalOptions extends RenderOptions {\n detectHostComponentNames?: boolean;\n}\n\nexport function renderInternal<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n unstable_validateStringsRenderedWithinText,\n detectHostComponentNames = true,\n }: RenderInternalOptions = {}\n) {\n if (detectHostComponentNames) {\n configureHostComponentNamesIfNeeded();\n }\n\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n createNodeMock,\n });\n }\n\n const wrap = (element: React.ReactElement) =>\n Wrapper ? <Wrapper>{element}</Wrapper> : element;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n {\n wrapper: Wrapper,\n createNodeMock,\n }: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {}\n) {\n const handleRender: React.ProfilerProps['onRender'] = (_, phase) => {\n if (phase === 'update') {\n validateStringsRenderedWithinText(screen.toJSON());\n }\n };\n\n const wrap = (element: React.ReactElement) => (\n <Profiler id=\"renderProfiler\" onRender={handleRender}>\n {Wrapper ? <Wrapper>{element}</Wrapper> : element}\n </Profiler>\n );\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n validateStringsRenderedWithinText(renderer.toJSON());\n\n return buildRenderResult(renderer, wrap);\n}\n\nfunction buildRenderResult(\n renderer: ReactTestRenderer,\n wrap: (element: React.ReactElement) => JSX.Element\n) {\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n get root(): ReactTestInstance {\n return getHostChildren(instance)[0];\n },\n UNSAFE_root: instance,\n };\n\n // Add as non-enumerable property, so that it's safe to enumerate\n // `render` result, e.g. using destructuring rest syntax.\n Object.defineProperty(result, 'container', {\n enumerable: false,\n get() {\n throw new Error(\n \"'container' property has been renamed to 'UNSAFE_root'.\\n\\n\" +\n \"Consider using 'root' property which returns root host element.\"\n );\n },\n });\n\n setRenderResult(result);\n return result;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\nexport interface DebugFunction {\n (options?: DebugOptions | string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(options?: DebugOptions | string) {\n const { defaultDebugOptions } = getConfig();\n const debugOptions =\n typeof options === 'string'\n ? { ...defaultDebugOptions, message: options }\n : { ...defaultDebugOptions, ...options };\n\n if (typeof options === 'string') {\n // eslint-disable-next-line no-console\n console.warn(\n 'Using debug(\"message\") is deprecated and will be removed in future release, please use debug({ message; \"message\" }) instead.'\n );\n }\n\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, debugOptions);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,IAAAC,KAAA,GAAAH,MAAA;AAE/B,IAAAI,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,aAAA,GAAAL,sBAAA,CAAAH,OAAA;AACA,IAAAS,mBAAA,GAAAT,OA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114
  findAllByText: notImplemented
115
115
  };
116
- let screen = defaultScreen;
117
- exports.screen = screen;
116
+ let screen = exports.screen = defaultScreen;
118
117
  function setRenderResult(output) {
119
118
  exports.screen = screen = output;
120
119
  }
@@ -1 +1 @@
1
- {"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","shallow","defaultScreen","root","UNSAFE_root","debug","update","unmount","rerender","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","getByA11yState","getAllByA11yState","queryByA11yState","queryAllByA11yState","findByA11yState","findAllByA11yState","getByAccessibilityState","getAllByAccessibilityState","queryByAccessibilityState","queryAllByAccessibilityState","findByAccessibilityState","findAllByAccessibilityState","getByA11yValue","getAllByA11yValue","queryByA11yValue","queryAllByA11yValue","findByA11yValue","findAllByA11yValue","getByAccessibilityValue","getAllByAccessibilityValue","queryByAccessibilityValue","queryAllByAccessibilityValue","findByAccessibilityValue","findAllByAccessibilityValue","UNSAFE_getByProps","UNSAFE_getAllByProps","UNSAFE_queryByProps","UNSAFE_queryAllByProps","UNSAFE_getByType","UNSAFE_getAllByType","UNSAFE_queryByType","UNSAFE_queryAllByType","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","output","clearRenderResult"],"sources":["../src/screen.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` method has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\nconst notImplementedDebug = () => {\n throw new Error(SCREEN_ERROR);\n};\nnotImplementedDebug.shallow = notImplemented;\n\nconst defaultScreen: RenderResult = {\n get root(): ReactTestInstance {\n throw new Error(SCREEN_ERROR);\n },\n get UNSAFE_root(): ReactTestInstance {\n throw new Error(SCREEN_ERROR);\n },\n debug: notImplementedDebug,\n update: notImplemented,\n unmount: notImplemented,\n rerender: 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 getByA11yState: notImplemented,\n getAllByA11yState: notImplemented,\n queryByA11yState: notImplemented,\n queryAllByA11yState: notImplemented,\n findByA11yState: notImplemented,\n findAllByA11yState: notImplemented,\n getByAccessibilityState: notImplemented,\n getAllByAccessibilityState: notImplemented,\n queryByAccessibilityState: notImplemented,\n queryAllByAccessibilityState: notImplemented,\n findByAccessibilityState: notImplemented,\n findAllByAccessibilityState: notImplemented,\n getByA11yValue: notImplemented,\n getAllByA11yValue: notImplemented,\n queryByA11yValue: notImplemented,\n queryAllByA11yValue: notImplemented,\n findByA11yValue: notImplemented,\n findAllByA11yValue: notImplemented,\n getByAccessibilityValue: notImplemented,\n getAllByAccessibilityValue: notImplemented,\n queryByAccessibilityValue: notImplemented,\n queryAllByAccessibilityValue: notImplemented,\n findByAccessibilityValue: notImplemented,\n findAllByAccessibilityValue: notImplemented,\n UNSAFE_getByProps: notImplemented,\n UNSAFE_getAllByProps: notImplemented,\n UNSAFE_queryByProps: notImplemented,\n UNSAFE_queryAllByProps: notImplemented,\n UNSAFE_getByType: notImplemented,\n UNSAFE_getAllByType: notImplemented,\n UNSAFE_queryByType: notImplemented,\n UNSAFE_queryAllByType: 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: RenderResult = defaultScreen;\n\nexport function setRenderResult(output: RenderResult) {\n screen = output;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"mappings":";;;;;;;;AAGA,MAAMA,YAAY,GAAG,qCAAqC;AAE1D,MAAMC,cAAc,GAAG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oBAAoB,EAAE1E,cAAc;EACpC2E,uBAAuB,EAAE3E,cAAc;EACvC4E,sBAAsB,EAAE5E,cAAc;EACtC6E,yBAAyB,EAAE7E,cAAc;EACzC8E,qBAAqB,EAAE9E,cAAc;EACrC+E,wBAAwB,EAAE/E,cAAc;EACxCgF,iBAAiB,EAAEhF,cAAc;EACjCiF,oBAAoB,EAAEjF,cAAc;EACpCkF,mBAAmB,EAAElF,cAAc;EACnCmF,sBAAsB,EAAEnF,cAAc;EACtCoF,kBAAkB,EAAEpF,cAAc;EAClCqF,qBAAqB,EAAErF,cAAc;EACrCsF,WAAW,EAAEtF,cAAc;EAC3BuF,cAAc,EAAEvF,cAAc;EAC9BwF,aAAa,EAAExF,cAAc;EAC7ByF,gBAAgB,EAAEzF,cAAc;EAChC0F,YAAY,EAAE1F,cAAc;EAC5B2F,eAAe,EAAE3F,cAAc;EAC/B4F,SAAS,EAAE5F,cAAc;EACzB6F,YAAY,EAAE7F,cAAc;EAC5B8F,WAAW,EAAE9F,cAAc;EAC3B+F,cAAc,EAAE/F,cAAc;EAC9BgG,UAAU,EAAEhG,cAAc;EAC1BiG,aAAa,EAAEjG;AACjB,CAAC;AAEM,IAAIkG,MAAoB,GAAG9F,aAAa;AAAC+F,OAAA,CAAAD,MAAA,GAAAA,MAAA;AAEzC,SAASE,eAAeA,CAACC,MAAoB,EAAE;EACpDF,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGG,MAAM;AACjB;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClCH,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAG9F,aAAa;AACxB"}
1
+ {"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","shallow","defaultScreen","root","UNSAFE_root","debug","update","unmount","rerender","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","getByA11yState","getAllByA11yState","queryByA11yState","queryAllByA11yState","findByA11yState","findAllByA11yState","getByAccessibilityState","getAllByAccessibilityState","queryByAccessibilityState","queryAllByAccessibilityState","findByAccessibilityState","findAllByAccessibilityState","getByA11yValue","getAllByA11yValue","queryByA11yValue","queryAllByA11yValue","findByA11yValue","findAllByA11yValue","getByAccessibilityValue","getAllByAccessibilityValue","queryByAccessibilityValue","queryAllByAccessibilityValue","findByAccessibilityValue","findAllByAccessibilityValue","UNSAFE_getByProps","UNSAFE_getAllByProps","UNSAFE_queryByProps","UNSAFE_queryAllByProps","UNSAFE_getByType","UNSAFE_getAllByType","UNSAFE_queryByType","UNSAFE_queryAllByType","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","output","clearRenderResult"],"sources":["../src/screen.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` method has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\nconst notImplementedDebug = () => {\n throw new Error(SCREEN_ERROR);\n};\nnotImplementedDebug.shallow = notImplemented;\n\nconst defaultScreen: RenderResult = {\n get root(): ReactTestInstance {\n throw new Error(SCREEN_ERROR);\n },\n get UNSAFE_root(): ReactTestInstance {\n throw new Error(SCREEN_ERROR);\n },\n debug: notImplementedDebug,\n update: notImplemented,\n unmount: notImplemented,\n rerender: 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 getByA11yState: notImplemented,\n getAllByA11yState: notImplemented,\n queryByA11yState: notImplemented,\n queryAllByA11yState: notImplemented,\n findByA11yState: notImplemented,\n findAllByA11yState: notImplemented,\n getByAccessibilityState: notImplemented,\n getAllByAccessibilityState: notImplemented,\n queryByAccessibilityState: notImplemented,\n queryAllByAccessibilityState: notImplemented,\n findByAccessibilityState: notImplemented,\n findAllByAccessibilityState: notImplemented,\n getByA11yValue: notImplemented,\n getAllByA11yValue: notImplemented,\n queryByA11yValue: notImplemented,\n queryAllByA11yValue: notImplemented,\n findByA11yValue: notImplemented,\n findAllByA11yValue: notImplemented,\n getByAccessibilityValue: notImplemented,\n getAllByAccessibilityValue: notImplemented,\n queryByAccessibilityValue: notImplemented,\n queryAllByAccessibilityValue: notImplemented,\n findByAccessibilityValue: notImplemented,\n findAllByAccessibilityValue: notImplemented,\n UNSAFE_getByProps: notImplemented,\n UNSAFE_getAllByProps: notImplemented,\n UNSAFE_queryByProps: notImplemented,\n UNSAFE_queryAllByProps: notImplemented,\n UNSAFE_getByType: notImplemented,\n UNSAFE_getAllByType: notImplemented,\n UNSAFE_queryByType: notImplemented,\n UNSAFE_queryAllByType: 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: RenderResult = defaultScreen;\n\nexport function setRenderResult(output: RenderResult) {\n screen = output;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"mappings":";;;;;;;;AAGA,MAAMA,YAAY,GAAG,qCAAqC;AAE1D,MAAMC,cAAc,GAAGA,CAAA,KAAM;EAC3B,MAAM,IAAIC,KAAK,CAACF,YAAY,CAAC;AAC/B,CAAC;AAED,MAAMG,mBAAmB,GAAGA,CAAA,KAAM;EAChC,MAAM,IAAID,KAAK,CAACF,YAAY,CAAC;AAC/B,CAAC;AACDG,mBAAmB,CAACC,OAAO,GAAGH,cAAc;AAE5C,MAAMI,aAA2B,GAAG;EAClC,IAAIC,IAAIA,CAAA,EAAsB;IAC5B,MAAM,IAAIJ,KAAK,CAACF,YAAY,CAAC;EAC/B,CAAC;EACD,IAAIO,WAAWA,CAAA,EAAsB;IACnC,MAAM,IAAIL,K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AAEtF,cAAc;EAC3BuF,cAAc,EAAEvF,cAAc;EAC9BwF,aAAa,EAAExF,cAAc;EAC7ByF,gBAAgB,EAAEzF,cAAc;EAChC0F,YAAY,EAAE1F,cAAc;EAC5B2F,eAAe,EAAE3F,cAAc;EAC/B4F,SAAS,EAAE5F,cAAc;EACzB6F,YAAY,EAAE7F,cAAc;EAC5B8F,WAAW,EAAE9F,cAAc;EAC3B+F,cAAc,EAAE/F,cAAc;EAC9BgG,UAAU,EAAEhG,cAAc;EAC1BiG,aAAa,EAAEjG;AACjB,CAAC;AAEM,IAAIkG,MAAoB,GAAAC,OAAA,CAAAD,MAAA,GAAG9F,aAAa;AAExC,SAASgG,eAAeA,CAACC,MAAoB,EAAE;EACpDF,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGG,MAAM;AACjB;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClCH,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAG9F,aAAa;AACxB"}
package/build/shallow.js CHANGED
@@ -7,8 +7,8 @@ exports.shallowInternal = shallowInternal;
7
7
  var React = _interopRequireWildcard(require("react"));
8
8
  var _shallow = _interopRequireDefault(require("react-test-renderer/shallow"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
+ 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); }
11
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
12
12
  // eslint-disable-line import/no-extraneous-dependencies
13
13
 
14
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"shallow.js","names":["React","_interopRequireWildcard","require","_shallow","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","shallowInternal","instance","renderer","ShallowRenderer","render","createElement","type","props","output","getRenderOutput"],"sources":["../src/shallow.ts"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies\n\n/**\n * Renders test component shallowly using react-test-renderer/shallow\n */\nexport function shallowInternal(\n instance: ReactTestInstance | React.ReactElement<any>\n): { output: any } {\n const renderer = new (ShallowRenderer as any)();\n\n renderer.render(React.createElement(instance.type, instance.props));\n\n return {\n output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AAA,CAAAT,OAAA,GAAAF,GAAA,MAAAQ,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAArB,GAAA,EAAAW,MAAA,YAAAA,MAAA;AAAC;;AAE3D;AACA;AACA;AACO,SAASW,eAAeA,CAC7BC,QAAqD,EACpC;EACjB,MAAMC,QAAQ,GAAG,IAAKC,gBAAe,CAAS,CAAC;EAE/CD,QAAQ,CAACE,MAAM,eAAC/B,KAAK,CAACgC,aAAa,CAACJ,QAAQ,CAACK,IAAI,EAAEL,QAAQ,CAACM,KAAK,CAAC,CAAC;EAEnE,OAAO;IACLC,MAAM,EAAEN,QAAQ,CAACO,eAAe,CAAC;EACnC,CAAC;AACH"}
1
+ {"version":3,"file":"shallow.js","names":["React","_interopRequireWildcard","require","_shallow","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","e","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","shallowInternal","instance","renderer","ShallowRenderer","render","createElement","type","props","output","getRenderOutput"],"sources":["../src/shallow.ts"],"sourcesContent":["import * as React from 'react';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport ShallowRenderer from 'react-test-renderer/shallow'; // eslint-disable-line import/no-extraneous-dependencies\n\n/**\n * Renders test component shallowly using react-test-renderer/shallow\n */\nexport function shallowInternal(\n instance: ReactTestInstance | React.ReactElement<any>\n): { output: any } {\n const renderer = new (ShallowRenderer as any)();\n\n renderer.render(React.createElement(instance.type, instance.props));\n\n return {\n output: renderer.getRenderOutput(),\n };\n}\n"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA0D,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,m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ACJ,QAAQ,CAACK,IAAI,EAAEL,QAAQ,CAACM,KAAK,CAAC,CAAC;EAEnE,OAAO;IACLC,MAAM,EAAEN,QAAQ,CAACO,eAAe,CAAC;EACnC,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- interface EventEntry {
1
+ export interface EventEntry {
2
2
  name: string;
3
3
  payload: any;
4
4
  }
@@ -7,4 +7,3 @@ export declare function createEventLogger(): {
7
7
  logEvent: (name: string) => (event: unknown) => void;
8
8
  };
9
9
  export declare function getEventsName(events: EventEntry[]): string[];
10
- export {};
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":["createEventLogger","events","logEvent","name","event","eventEntry","payload","push","getEventsName","map"],"sources":["../../src/test-utils/events.ts"],"sourcesContent":["interface EventEntry {\n name: string;\n payload: any;\n}\n\nexport function createEventLogger() {\n const events: EventEntry[] = [];\n const logEvent = (name: string) => {\n return (event: unknown) => {\n const eventEntry: EventEntry = {\n name,\n payload: event,\n };\n\n events.push(eventEntry);\n };\n };\n\n return { events, logEvent };\n}\n\nexport function getEventsName(events: EventEntry[]) {\n return events.map((event) => event.name);\n}\n"],"mappings":";;;;;;;AAKO,SAASA,iBAAiBA,CAAA,EAAG;EAClC,MAAMC,MAAoB,GAAG,EAAE;EAC/B,MAAMC,QAAQ,GAAIC,IAAY,IAAK;IACjC,OAAQC,KAAc,IAAK;MACzB,MAAMC,UAAsB,GAAG;QAC7BF,IAAI;QACJG,OAAO,EAAEF;MACX,CAAC;MAEDH,MAAM,CAACM,IAAI,CAACF,UAAU,CAAC;IACzB,CAAC;EACH,CAAC;EAED,OAAO;IAAEJ,MAAM;IAAEC;EAAS,CAAC;AAC7B;AAEO,SAASM,aAAaA,CAACP,MAAoB,EAAE;EAClD,OAAOA,MAAM,CAACQ,GAAG,CAAEL,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;AAC1C"}
1
+ {"version":3,"file":"events.js","names":["createEventLogger","events","logEvent","name","event","eventEntry","payload","push","getEventsName","map"],"sources":["../../src/test-utils/events.ts"],"sourcesContent":["export interface EventEntry {\n name: string;\n payload: any;\n}\n\nexport function createEventLogger() {\n const events: EventEntry[] = [];\n const logEvent = (name: string) => {\n return (event: unknown) => {\n const eventEntry: EventEntry = {\n name,\n payload: event,\n };\n\n events.push(eventEntry);\n };\n };\n\n return { events, logEvent };\n}\n\nexport function getEventsName(events: EventEntry[]) {\n return events.map((event) => event.name);\n}\n"],"mappings":";;;;;;;AAKO,SAASA,iBAAiBA,CAAA,EAAG;EAClC,MAAMC,MAAoB,GAAG,EAAE;EAC/B,MAAMC,QAAQ,GAAIC,IAAY,IAAK;IACjC,OAAQC,KAAc,IAAK;MACzB,MAAMC,UAAsB,GAAG;QAC7BF,IAAI;QACJG,OAAO,EAAEF;MACX,CAAC;MAEDH,MAAM,CAACM,IAAI,CAACF,UAAU,CAAC;IACzB,CAAC;EACH,CAAC;EAED,OAAO;IAAEJ,MAAM;IAAEC;EAAS,CAAC;AAC7B;AAEO,SAASM,aAAaA,CAACP,MAAoB,EAAE;EAClD,OAAOA,MAAM,CAACQ,GAAG,CAAEL,KAAK,IAAKA,KAAK,CAACD,IAAI,CAAC;AAC1C"}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.clear = clear;
7
7
  var _errors = require("../helpers/errors");
8
8
  var _hostComponentNames = require("../helpers/host-component-names");
9
+ var _textInput = require("../helpers/text-input");
9
10
  var _pointerEvents = require("../helpers/pointer-events");
10
11
  var _eventBuilder = require("./event-builder");
11
12
  var _utils = require("./utils");
@@ -14,7 +15,7 @@ async function clear(element) {
14
15
  if (!(0, _hostComponentNames.isHostTextInput)(element)) {
15
16
  throw new _errors.ErrorWithStack(`clear() only supports host "TextInput" elements. Passed element has type: "${element.type}".`, clear);
16
17
  }
17
- if (!(0, _utils.isEditableTextInput)(element) || !(0, _pointerEvents.isPointerEventEnabled)(element)) {
18
+ if (!(0, _textInput.isTextInputEditable)(element) || !(0, _pointerEvents.isPointerEventEnabled)(element)) {
18
19
  return;
19
20
  }
20
21
 
@@ -1 +1 @@
1
- {"version":3,"file":"clear.js","names":["_errors","require","_hostComponentNames","_pointerEvents","_eventBuilder","_utils","_type","clear","element","isHostTextInput","ErrorWithStack","type","isEditableTextInput","isPointerEventEnabled","dispatchEvent","EventBuilder","Common","focus","previousText","props","value","defaultValue","selectionRange","start","end","length","TextInput","selectionChange","finalText","emitTypingEvents","config","wait","endEditing","blur"],"sources":["../../src/user-event/clear.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { isPointerEventEnabled } from '../helpers/pointer-events';\nimport { EventBuilder } from './event-builder';\nimport { UserEventInstance } from './setup';\nimport { dispatchEvent, wait, isEditableTextInput } from './utils';\nimport { emitTypingEvents } from './type/type';\n\nexport async function clear(\n this: UserEventInstance,\n element: ReactTestInstance\n): 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 dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n // 2. Select all\n const previousText = element.props.value ?? element.props.defaultValue ?? '';\n const selectionRange = {\n start: 0,\n end: previousText.length,\n };\n dispatchEvent(\n element,\n 'selectionChange',\n EventBuilder.TextInput.selectionChange(selectionRange)\n );\n\n // 3. Press backspace\n const finalText = '';\n await emitTypingEvents(\n this.config,\n element,\n 'Backspace',\n finalText,\n previousText\n );\n\n // 4. Exit element\n await wait(this.config);\n dispatchEvent(\n element,\n 'endEditing',\n EventBuilder.TextInput.endEditing(finalText)\n );\n\n dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,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AAI,CAAC,CAAC,CAAC;AAC5D"}
1
+ {"version":3,"file":"clear.js","names":["_errors","require","_hostComponentNames","_textInput","_pointerEvents","_eventBuilder","_utils","_type","clear","element","isHostTextInput","ErrorWithStack","type","isTextInputEditable","isPointerEventEnabled","dispatchEvent","EventBuilder","Common","focus","previousText","props","value","defaultValue","selectionRange","start","end","length","TextInput","selectionChange","finalText","emitTypingEvents","config","wait","endEditing","blur"],"sources":["../../src/user-event/clear.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostTextInput } from '../helpers/host-component-names';\nimport { isTextInputEditable } from '../helpers/text-input';\nimport { isPointerEventEnabled } from '../helpers/pointer-events';\nimport { EventBuilder } from './event-builder';\nimport { UserEventInstance } from './setup';\nimport { dispatchEvent, wait } from './utils';\nimport { emitTypingEvents } from './type/type';\n\nexport async function clear(\n this: UserEventInstance,\n element: ReactTestInstance\n): 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 (!isTextInputEditable(element) || !isPointerEventEnabled(element)) {\n return;\n }\n\n // 1. Enter element\n dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n // 2. Select all\n const previousText = element.props.value ?? element.props.defaultValue ?? '';\n const selectionRange = {\n start: 0,\n end: previousText.length,\n };\n dispatchEvent(\n element,\n 'selectionChange',\n EventBuilder.TextInput.selectionChange(selectionRange)\n );\n\n // 3. Press backspace\n const finalText = '';\n await emitTypingEvents(\n this.config,\n element,\n 'Backspace',\n finalText,\n previousText\n );\n\n // 4. Exit element\n await wait(this.config);\n dispatchEvent(\n element,\n 'endEditing',\n EventBuilder.TextInput.endEditing(finalText)\n );\n\n dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAD,OA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EAAE,MAAM,EAAEO,0BAAY,CAACC,MAAM,CAACiB,IAAI,CAAC,CAAC,CAAC;AAC5D"}
@@ -28,7 +28,7 @@ function touch() {
28
28
  }
29
29
  };
30
30
  }
31
- const CommonEventBuilder = {
31
+ const CommonEventBuilder = exports.CommonEventBuilder = {
32
32
  touch,
33
33
  responderGrant: () => {
34
34
  return {
@@ -71,5 +71,4 @@ const CommonEventBuilder = {
71
71
  };
72
72
  }
73
73
  };
74
- exports.CommonEventBuilder = CommonEventBuilder;
75
74
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","names":["touch","persist","jest","fn","currentTarget","measure","nativeEvent","changedTouches","identifier","locationX","locationY","pageX","pageY","target","timestamp","Date","now","touches","CommonEventBuilder","responderGrant","dispatchConfig","registrationName","responderRelease","focus","blur","exports"],"sources":["../../../src/user-event/event-builder/common.ts"],"sourcesContent":["/**\n * Experimental values:\n * - iOS: `{\"changedTouches\": [[Circular]], \"identifier\": 1, \"locationX\": 253, \"locationY\": 30.333328247070312, \"pageX\": 273, \"pageY\": 141.3333282470703, \"target\": 75, \"timestamp\": 875928682.0450834, \"touches\": [[Circular]]}`\n * - Android: `{\"changedTouches\": [[Circular]], \"identifier\": 0, \"locationX\": 160, \"locationY\": 40.3636360168457, \"pageX\": 180, \"pageY\": 140.36363220214844, \"target\": 53, \"targetSurface\": -1, \"timestamp\": 10290805, \"touches\": [[Circular]]}`\n */\nfunction touch() {\n return {\n persist: jest.fn(),\n currentTarget: { measure: jest.fn() },\n nativeEvent: {\n changedTouches: [],\n identifier: 0,\n locationX: 0,\n locationY: 0,\n pageX: 0,\n pageY: 0,\n target: 0,\n timestamp: Date.now(),\n touches: [],\n },\n };\n}\n\nexport const CommonEventBuilder = {\n touch,\n\n responderGrant: () => {\n return {\n ...touch(),\n dispatchConfig: { registrationName: 'onResponderGrant' },\n };\n },\n\n responderRelease: () => {\n return {\n ...touch(),\n dispatchConfig: { registrationName: 'onResponderRelease' },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\n focus: () => {\n return {\n nativeEvent: {\n target: 0,\n },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\n blur: () => {\n return {\n nativeEvent: {\n target: 0,\n },\n };\n },\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAKA,CAAA,EAAG;EACf,OAAO;IACLC,OAAO,EAAEC,IAAI,CAACC,EAAE,CAAC,CAAC;IAClBC,aAAa,EAAE;MAAEC,OAAO,EAAEH,IAAI,CAACC,EAAE,CAAC;IAAE,CAAC;IACrCG,WAAW,EAAE;MACXC,cAAc,EAAE,EAAE;MAClBC,UAAU,EAAE,CAAC;MACbC,SAAS,EAAE,CAAC;MACZC,SAAS,EAAE,CAAC;MACZC,KAAK,EAAE,CAAC;MACRC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CAAC;MACTC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MACrBC,OAAO,EAAE;IACX;EACF,CAAC;AACH;AAEO,MAAMC,kBAAkB,GAAG;EAChClB,KAAK;EAELmB,cAAc,EAAEA,CAAA,KAAM;IACpB,OAAO;MACL,GAAGnB,KAAK,CAAC,CAAC;MACVoB,cAAc,EAAE;QAAEC,gBAAgB,EAAE;MAAmB;IACzD,CAAC;EACH,CAAC;EAEDC,gBAAgB,EAAEA,CAAA,KAAM;IACtB,OAAO;MACL,GAAGtB,KAAK,CAAC,CAAC;MACVoB,cAAc,EAAE;QAAEC,gBAAgB,EAAE;MAAqB;IAC3D,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,KAAK,EAAEA,CAAA,KAAM;IACX,OAAO;MACLjB,WAAW,EAAE;QACXO,MAAM,EAAE;MACV;IACF,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEW,IAAI,EAAEA,CAAA,KAAM;IACV,OAAO;MACLlB,WAAW,EAAE;QACXO,MAAM,EAAE;MACV;IACF,CAAC;EACH;AACF,CAAC;AAACY,OAAA,CAAAP,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"file":"common.js","names":["touch","persist","jest","fn","currentTarget","measure","nativeEvent","changedTouches","identifier","locationX","locationY","pageX","pageY","target","timestamp","Date","now","touches","CommonEventBuilder","exports","responderGrant","dispatchConfig","registrationName","responderRelease","focus","blur"],"sources":["../../../src/user-event/event-builder/common.ts"],"sourcesContent":["/**\n * Experimental values:\n * - iOS: `{\"changedTouches\": [[Circular]], \"identifier\": 1, \"locationX\": 253, \"locationY\": 30.333328247070312, \"pageX\": 273, \"pageY\": 141.3333282470703, \"target\": 75, \"timestamp\": 875928682.0450834, \"touches\": [[Circular]]}`\n * - Android: `{\"changedTouches\": [[Circular]], \"identifier\": 0, \"locationX\": 160, \"locationY\": 40.3636360168457, \"pageX\": 180, \"pageY\": 140.36363220214844, \"target\": 53, \"targetSurface\": -1, \"timestamp\": 10290805, \"touches\": [[Circular]]}`\n */\nfunction touch() {\n return {\n persist: jest.fn(),\n currentTarget: { measure: jest.fn() },\n nativeEvent: {\n changedTouches: [],\n identifier: 0,\n locationX: 0,\n locationY: 0,\n pageX: 0,\n pageY: 0,\n target: 0,\n timestamp: Date.now(),\n touches: [],\n },\n };\n}\n\nexport const CommonEventBuilder = {\n touch,\n\n responderGrant: () => {\n return {\n ...touch(),\n dispatchConfig: { registrationName: 'onResponderGrant' },\n };\n },\n\n responderRelease: () => {\n return {\n ...touch(),\n dispatchConfig: { registrationName: 'onResponderRelease' },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\n focus: () => {\n return {\n nativeEvent: {\n target: 0,\n },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 0, \"target\": 75, \"text\": \"\"}`\n * - Android: `{\"target\": 53}`\n */\n blur: () => {\n return {\n nativeEvent: {\n target: 0,\n },\n };\n },\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAKA,CAAA,EAAG;EACf,OAAO;IACLC,OAAO,EAAEC,IAAI,CAACC,EAAE,CAAC,CAAC;IAClBC,aAAa,EAAE;MAAEC,OAAO,EAAEH,IAAI,CAACC,EAAE,CAAC;IAAE,CAAC;IACrCG,WAAW,EAAE;MACXC,cAAc,EAAE,EAAE;MAClBC,UAAU,EAAE,CAAC;MACbC,SAAS,EAAE,CAAC;MACZC,SAAS,EAAE,CAAC;MACZC,KAAK,EAAE,CAAC;MACRC,KAAK,EAAE,CAAC;MACRC,MAAM,EAAE,CAAC;MACTC,SAAS,EAAEC,IAAI,CAACC,GAAG,CAAC,CAAC;MACrBC,OAAO,EAAE;IACX;EACF,CAAC;AACH;AAEO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG;EAChClB,KAAK;EAELoB,cAAc,EAAEA,CAAA,KAAM;IACpB,OAAO;MACL,GAAGpB,KAAK,CAAC,CAAC;MACVqB,cAAc,EAAE;QAAEC,gBAAgB,EAAE;MAAmB;IACzD,CAAC;EACH,CAAC;EAEDC,gBAAgB,EAAEA,CAAA,KAAM;IACtB,OAAO;MACL,GAAGvB,KAAK,CAAC,CAAC;MACVqB,cAAc,EAAE;QAAEC,gBAAgB,EAAE;MAAqB;IAC3D,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,KAAK,EAAEA,CAAA,KAAM;IACX,OAAO;MACLlB,WAAW,EAAE;QACXO,MAAM,EAAE;MACV;IACF,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEY,IAAI,EAAEA,CAAA,KAAM;IACV,OAAO;MACLnB,WAAW,EAAE;QACXO,MAAM,EAAE;MACV;IACF,CAAC;EACH;AACF,CAAC"}
@@ -69,6 +69,36 @@ export declare const EventBuilder: {
69
69
  };
70
70
  };
71
71
  };
72
+ ScrollView: {
73
+ scroll: (offset?: import("./scroll-view").ContentOffset) => {
74
+ nativeEvent: {
75
+ contentInset: {
76
+ bottom: number;
77
+ left: number;
78
+ right: number;
79
+ top: number;
80
+ };
81
+ contentOffset: {
82
+ y: number;
83
+ x: number;
84
+ };
85
+ contentSize: {
86
+ height: number;
87
+ width: number;
88
+ };
89
+ layoutMeasurement: {
90
+ height: number;
91
+ width: number;
92
+ };
93
+ responderIgnoreScroll: boolean;
94
+ target: number;
95
+ velocity: {
96
+ y: number;
97
+ x: number;
98
+ };
99
+ };
100
+ };
101
+ };
72
102
  TextInput: {
73
103
  change: (text: string) => {
74
104
  nativeEvent: {
@@ -5,10 +5,11 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.EventBuilder = void 0;
7
7
  var _common = require("./common");
8
+ var _scrollView = require("./scroll-view");
8
9
  var _textInput = require("./text-input");
9
- const EventBuilder = {
10
+ const EventBuilder = exports.EventBuilder = {
10
11
  Common: _common.CommonEventBuilder,
12
+ ScrollView: _scrollView.ScrollViewEventBuilder,
11
13
  TextInput: _textInput.TextInputEventBuilder
12
14
  };
13
- exports.EventBuilder = EventBuilder;
14
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_common","require","_textInput","EventBuilder","Common","CommonEventBuilder","TextInput","TextInputEventBuilder","exports"],"sources":["../../../src/user-event/event-builder/index.ts"],"sourcesContent":["import { CommonEventBuilder } from './common';\nimport { TextInputEventBuilder } from './text-input';\n\nexport const EventBuilder = {\n Common: CommonEventBuilder,\n TextInput: TextInputEventBuilder,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEO,MAAME,YAAY,GAAG;EAC1BC,MAAM,EAAEC,0BAAkB;EAC1BC,SAAS,EAAEC;AACb,CAAC;AAACC,OAAA,CAAAL,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"file":"index.js","names":["_common","require","_scrollView","_textInput","EventBuilder","exports","Common","CommonEventBuilder","ScrollView","ScrollViewEventBuilder","TextInput","TextInputEventBuilder"],"sources":["../../../src/user-event/event-builder/index.ts"],"sourcesContent":["import { CommonEventBuilder } from './common';\nimport { ScrollViewEventBuilder } from './scroll-view';\nimport { TextInputEventBuilder } from './text-input';\n\nexport const EventBuilder = {\n Common: CommonEventBuilder,\n ScrollView: ScrollViewEventBuilder,\n TextInput: TextInputEventBuilder,\n};\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAEO,MAAMG,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1BE,MAAM,EAAEC,0BAAkB;EAC1BC,UAAU,EAAEC,kCAAsB;EAClCC,SAAS,EAAEC;AACb,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Experimental values:
3
+ * - iOS: `{"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 5.333333333333333}, "contentSize": {"height": 1676.6666259765625, "width": 390}, "layoutMeasurement": {"height": 753, "width": 390}, "zoomScale": 1}`
4
+ * - Android: `{"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 31.619047164916992}, "contentSize": {"height": 1624.761962890625, "width": 411.4285583496094}, "layoutMeasurement": {"height": 785.5238037109375, "width": 411.4285583496094}, "responderIgnoreScroll": true, "target": 139, "velocity": {"x": -1.3633992671966553, "y": -1.3633992671966553}}`
5
+ */
6
+ /**
7
+ * Scroll position of a scrollable element.
8
+ */
9
+ export interface ContentOffset {
10
+ y: number;
11
+ x: number;
12
+ }
13
+ export declare const ScrollViewEventBuilder: {
14
+ scroll: (offset?: ContentOffset) => {
15
+ nativeEvent: {
16
+ contentInset: {
17
+ bottom: number;
18
+ left: number;
19
+ right: number;
20
+ top: number;
21
+ };
22
+ contentOffset: {
23
+ y: number;
24
+ x: number;
25
+ };
26
+ contentSize: {
27
+ height: number;
28
+ width: number;
29
+ };
30
+ layoutMeasurement: {
31
+ height: number;
32
+ width: number;
33
+ };
34
+ responderIgnoreScroll: boolean;
35
+ target: number;
36
+ velocity: {
37
+ y: number;
38
+ x: number;
39
+ };
40
+ };
41
+ };
42
+ };
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ScrollViewEventBuilder = void 0;
7
+ /**
8
+ * Experimental values:
9
+ * - iOS: `{"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 5.333333333333333}, "contentSize": {"height": 1676.6666259765625, "width": 390}, "layoutMeasurement": {"height": 753, "width": 390}, "zoomScale": 1}`
10
+ * - Android: `{"contentInset": {"bottom": 0, "left": 0, "right": 0, "top": 0}, "contentOffset": {"x": 0, "y": 31.619047164916992}, "contentSize": {"height": 1624.761962890625, "width": 411.4285583496094}, "layoutMeasurement": {"height": 785.5238037109375, "width": 411.4285583496094}, "responderIgnoreScroll": true, "target": 139, "velocity": {"x": -1.3633992671966553, "y": -1.3633992671966553}}`
11
+ */
12
+
13
+ /**
14
+ * Scroll position of a scrollable element.
15
+ */
16
+
17
+ const ScrollViewEventBuilder = exports.ScrollViewEventBuilder = {
18
+ scroll: (offset = {
19
+ y: 0,
20
+ x: 0
21
+ }) => {
22
+ return {
23
+ nativeEvent: {
24
+ contentInset: {
25
+ bottom: 0,
26
+ left: 0,
27
+ right: 0,
28
+ top: 0
29
+ },
30
+ contentOffset: {
31
+ y: offset.y,
32
+ x: offset.x
33
+ },
34
+ contentSize: {
35
+ height: 0,
36
+ width: 0
37
+ },
38
+ layoutMeasurement: {
39
+ height: 0,
40
+ width: 0
41
+ },
42
+ responderIgnoreScroll: true,
43
+ target: 0,
44
+ velocity: {
45
+ y: 0,
46
+ x: 0
47
+ }
48
+ }
49
+ };
50
+ }
51
+ };
52
+ //# sourceMappingURL=scroll-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scroll-view.js","names":["ScrollViewEventBuilder","exports","scroll","offset","y","x","nativeEvent","contentInset","bottom","left","right","top","contentOffset","contentSize","height","width","layoutMeasurement","responderIgnoreScroll","target","velocity"],"sources":["../../../src/user-event/event-builder/scroll-view.ts"],"sourcesContent":["/**\n * Experimental values:\n * - iOS: `{\"contentInset\": {\"bottom\": 0, \"left\": 0, \"right\": 0, \"top\": 0}, \"contentOffset\": {\"x\": 0, \"y\": 5.333333333333333}, \"contentSize\": {\"height\": 1676.6666259765625, \"width\": 390}, \"layoutMeasurement\": {\"height\": 753, \"width\": 390}, \"zoomScale\": 1}`\n * - Android: `{\"contentInset\": {\"bottom\": 0, \"left\": 0, \"right\": 0, \"top\": 0}, \"contentOffset\": {\"x\": 0, \"y\": 31.619047164916992}, \"contentSize\": {\"height\": 1624.761962890625, \"width\": 411.4285583496094}, \"layoutMeasurement\": {\"height\": 785.5238037109375, \"width\": 411.4285583496094}, \"responderIgnoreScroll\": true, \"target\": 139, \"velocity\": {\"x\": -1.3633992671966553, \"y\": -1.3633992671966553}}`\n */\n\n/**\n * Scroll position of a scrollable element.\n */\nexport interface ContentOffset {\n y: number;\n x: number;\n}\n\nexport const ScrollViewEventBuilder = {\n scroll: (offset: ContentOffset = { y: 0, x: 0 }) => {\n return {\n nativeEvent: {\n contentInset: { bottom: 0, left: 0, right: 0, top: 0 },\n contentOffset: { y: offset.y, x: offset.x },\n contentSize: { height: 0, width: 0 },\n layoutMeasurement: {\n height: 0,\n width: 0,\n },\n responderIgnoreScroll: true,\n target: 0,\n velocity: { y: 0, x: 0 },\n },\n };\n },\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAMO,MAAMA,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG;EACpCE,MAAM,EAAEA,CAACC,MAAqB,GAAG;IAAEC,CAAC,EAAE,CAAC;IAAEC,CAAC,EAAE;EAAE,CAAC,KAAK;IAClD,OAAO;MACLC,WAAW,EAAE;QACXC,YAAY,EAAE;UAAEC,MAAM,EAAE,CAAC;UAAEC,IAAI,EAAE,CAAC;UAAEC,KAAK,EAAE,CAAC;UAAEC,GAAG,EAAE;QAAE,CAAC;QACtDC,aAAa,EAAE;UAAER,CAAC,EAAED,MAAM,CAACC,CAAC;UAAEC,CAAC,EAAEF,MAAM,CAACE;QAAE,CAAC;QAC3CQ,WAAW,EAAE;UAAEC,MAAM,EAAE,CAAC;UAAEC,KAAK,EAAE;QAAE,CAAC;QACpCC,iBAAiB,EAAE;UACjBF,MAAM,EAAE,CAAC;UACTC,KAAK,EAAE;QACT,CAAC;QACDE,qBAAqB,EAAE,IAAI;QAC3BC,MAAM,EAAE,CAAC;QACTC,QAAQ,EAAE;UAAEf,CAAC,EAAE,CAAC;UAAEC,CAAC,EAAE;QAAE;MACzB;IACF,CAAC;EACH;AACF,CAAC"}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.TextInputEventBuilder = void 0;
7
- const TextInputEventBuilder = {
7
+ const TextInputEventBuilder = exports.TextInputEventBuilder = {
8
8
  /**
9
9
  * Experimental values:
10
10
  * - iOS: `{"eventCount": 4, "target": 75, "text": "Test"}`
@@ -113,5 +113,4 @@ const TextInputEventBuilder = {
113
113
  };
114
114
  }
115
115
  };
116
- exports.TextInputEventBuilder = TextInputEventBuilder;
117
116
  //# sourceMappingURL=text-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"text-input.js","names":["TextInputEventBuilder","change","text","nativeEvent","target","eventCount","keyPress","key","submitEditing","endEditing","selectionChange","start","end","selection","textInput","previousText","range","length","contentSizeChange","width","height","contentSize","exports"],"sources":["../../../src/user-event/event-builder/text-input.ts"],"sourcesContent":["import { ContentSize } from '../utils/content-size';\nimport { TextRange } from '../utils/text-range';\n\nexport const TextInputEventBuilder = {\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 4, \"target\": 75, \"text\": \"Test\"}`\n * - Android: `{\"eventCount\": 6, \"target\": 53, \"text\": \"Tes\"}`\n */\n change: (text: string) => {\n return {\n nativeEvent: { text, target: 0, eventCount: 0 },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 3, \"key\": \"a\", \"target\": 75}`\n * - Android: `{\"key\": \"a\"}`\n */\n keyPress: (key: string) => {\n return {\n nativeEvent: { key },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 4, \"target\": 75, \"text\": \"Test\"}`\n * - Android: `{\"target\": 53, \"text\": \"Test\"}`\n */\n submitEditing: (text: string) => {\n return {\n nativeEvent: { text, target: 0 },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 4, \"target\": 75, \"text\": \"Test\"}`\n * - Android: `{\"target\": 53, \"text\": \"Test\"}`\n */\n endEditing: (text: string) => {\n return {\n nativeEvent: { text, target: 0 },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"selection\": {\"end\": 4, \"start\": 4}, \"target\": 75}`\n * - Android: `{\"selection\": {\"end\": 4, \"start\": 4}}`\n */\n selectionChange: ({ start, end }: TextRange) => {\n return {\n nativeEvent: { selection: { start, end } },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 2, \"previousText\": \"Te\", \"range\": {\"end\": 2, \"start\": 2}, \"target\": 75, \"text\": \"s\"}`\n * - Android: `{\"previousText\": \"Te\", \"range\": {\"end\": 2, \"start\": 0}, \"target\": 53, \"text\": \"Tes\"}`\n */\n textInput: (text: string, previousText: string) => {\n return {\n nativeEvent: {\n text,\n previousText,\n range: { start: text.length, end: text.length },\n target: 0,\n },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"contentSize\": {\"height\": 21.666666666666668, \"width\": 11.666666666666666}, \"target\": 75}`\n * - Android: `{\"contentSize\": {\"height\": 61.45454406738281, \"width\": 352.7272644042969}, \"target\": 53}`\n */\n contentSizeChange: ({ width, height }: ContentSize) => {\n return {\n nativeEvent: { contentSize: { width, height }, target: 0 },\n };\n },\n};\n"],"mappings":";;;;;;AAGO,MAAMA,qBAAqB,GAAG;EACnC;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAGC,IAAY,IAAK;IACxB,OAAO;MACLC,WAAW,EAAE;QAAED,IAAI;QAAEE,MAAM,EAAE,CAAC;QAAEC,UAAU,EAAE;MAAE;IAChD,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAGC,GAAW,IAAK;IACzB,OAAO;MACLJ,WAAW,EAAE;QAAEI;MAAI;IACrB,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,aAAa,EAAGN,IAAY,IAAK;IAC/B,OAAO;MACLC,WAAW,EAAE;QAAED,IAAI;QAAEE,MAAM,EAAE;MAAE;IACjC,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEK,UAAU,EAAGP,IAAY,IAAK;IAC5B,OAAO;MACLC,WAAW,EAAE;QAAED,IAAI;QAAEE,MAAM,EAAE;MAAE;IACjC,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEM,eAAe,EAAEA,CAAC;IAAEC,KAAK;IAAEC;EAAe,CAAC,KAAK;IAC9C,OAAO;MACLT,WAAW,EAAE;QAAEU,SAAS,EAAE;UAAEF,KAAK;UAAEC;QAAI;MAAE;IAC3C,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,SAAS,EAAEA,CAACZ,IAAY,EAAEa,YAAoB,KAAK;IACjD,OAAO;MACLZ,WAAW,EAAE;QACXD,IAAI;QACJa,YAAY;QACZC,KAAK,EAAE;UAAEL,KAAK,EAAET,IAAI,CAACe,MAAM;UAAEL,GAAG,EAAEV,IAAI,CAACe;QAAO,CAAC;QAC/Cb,MAAM,EAAE;MACV;IACF,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEc,iBAAiB,EAAEA,CAAC;IAAEC,KAAK;IAAEC;EAAoB,CAAC,KAAK;IACrD,OAAO;MACLjB,WAAW,EAAE;QAAEkB,WAAW,EAAE;UAAEF,KAAK;UAAEC;QAAO,CAAC;QAAEhB,MAAM,EAAE;MAAE;IAC3D,CAAC;EACH;AACF,CAAC;AAACkB,OAAA,CAAAtB,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"file":"text-input.js","names":["TextInputEventBuilder","exports","change","text","nativeEvent","target","eventCount","keyPress","key","submitEditing","endEditing","selectionChange","start","end","selection","textInput","previousText","range","length","contentSizeChange","width","height","contentSize"],"sources":["../../../src/user-event/event-builder/text-input.ts"],"sourcesContent":["import { ContentSize } from '../utils/content-size';\nimport { TextRange } from '../utils/text-range';\n\nexport const TextInputEventBuilder = {\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 4, \"target\": 75, \"text\": \"Test\"}`\n * - Android: `{\"eventCount\": 6, \"target\": 53, \"text\": \"Tes\"}`\n */\n change: (text: string) => {\n return {\n nativeEvent: { text, target: 0, eventCount: 0 },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 3, \"key\": \"a\", \"target\": 75}`\n * - Android: `{\"key\": \"a\"}`\n */\n keyPress: (key: string) => {\n return {\n nativeEvent: { key },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 4, \"target\": 75, \"text\": \"Test\"}`\n * - Android: `{\"target\": 53, \"text\": \"Test\"}`\n */\n submitEditing: (text: string) => {\n return {\n nativeEvent: { text, target: 0 },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 4, \"target\": 75, \"text\": \"Test\"}`\n * - Android: `{\"target\": 53, \"text\": \"Test\"}`\n */\n endEditing: (text: string) => {\n return {\n nativeEvent: { text, target: 0 },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"selection\": {\"end\": 4, \"start\": 4}, \"target\": 75}`\n * - Android: `{\"selection\": {\"end\": 4, \"start\": 4}}`\n */\n selectionChange: ({ start, end }: TextRange) => {\n return {\n nativeEvent: { selection: { start, end } },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"eventCount\": 2, \"previousText\": \"Te\", \"range\": {\"end\": 2, \"start\": 2}, \"target\": 75, \"text\": \"s\"}`\n * - Android: `{\"previousText\": \"Te\", \"range\": {\"end\": 2, \"start\": 0}, \"target\": 53, \"text\": \"Tes\"}`\n */\n textInput: (text: string, previousText: string) => {\n return {\n nativeEvent: {\n text,\n previousText,\n range: { start: text.length, end: text.length },\n target: 0,\n },\n };\n },\n\n /**\n * Experimental values:\n * - iOS: `{\"contentSize\": {\"height\": 21.666666666666668, \"width\": 11.666666666666666}, \"target\": 75}`\n * - Android: `{\"contentSize\": {\"height\": 61.45454406738281, \"width\": 352.7272644042969}, \"target\": 53}`\n */\n contentSizeChange: ({ width, height }: ContentSize) => {\n return {\n nativeEvent: { contentSize: { width, height }, target: 0 },\n };\n },\n};\n"],"mappings":";;;;;;AAGO,MAAMA,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG;EACnC;AACF;AACA;AACA;AACA;EACEE,MAAM,EAAGC,IAAY,IAAK;IACxB,OAAO;MACLC,WAAW,EAAE;QAAED,IAAI;QAAEE,MAAM,EAAE,CAAC;QAAEC,UAAU,EAAE;MAAE;IAChD,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,QAAQ,EAAGC,GAAW,IAAK;IACzB,OAAO;MACLJ,WAAW,EAAE;QAAEI;MAAI;IACrB,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,aAAa,EAAGN,IAAY,IAAK;IAC/B,OAAO;MACLC,WAAW,EAAE;QAAED,IAAI;QAAEE,MAAM,EAAE;MAAE;IACjC,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEK,UAAU,EAAGP,IAAY,IAAK;IAC5B,OAAO;MACLC,WAAW,EAAE;QAAED,IAAI;QAAEE,MAAM,EAAE;MAAE;IACjC,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEM,eAAe,EAAEA,CAAC;IAAEC,KAAK;IAAEC;EAAe,CAAC,KAAK;IAC9C,OAAO;MACLT,WAAW,EAAE;QAAEU,SAAS,EAAE;UAAEF,KAAK;UAAEC;QAAI;MAAE;IAC3C,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEE,SAAS,EAAEA,CAACZ,IAAY,EAAEa,YAAoB,KAAK;IACjD,OAAO;MACLZ,WAAW,EAAE;QACXD,IAAI;QACJa,YAAY;QACZC,KAAK,EAAE;UAAEL,KAAK,EAAET,IAAI,CAACe,MAAM;UAAEL,GAAG,EAAEV,IAAI,CAACe;QAAO,CAAC;QAC/Cb,MAAM,EAAE;MACV;IACF,CAAC;EACH,CAAC;EAED;AACF;AACA;AACA;AACA;EACEc,iBAAiB,EAAEA,CAAC;IAAEC,KAAK;IAAEC;EAAoB,CAAC,KAAK;IACrD,OAAO;MACLjB,WAAW,EAAE;QAAEkB,WAAW,EAAE;UAAEF,KAAK;UAAEC;QAAO,CAAC;QAAEhB,MAAM,EAAE;MAAE;IAC3D,CAAC;EACH;AACF,CAAC"}
@@ -2,6 +2,7 @@ import { ReactTestInstance } from 'react-test-renderer';
2
2
  import { setup } from './setup';
3
3
  import { PressOptions } from './press';
4
4
  import { TypeOptions } from './type';
5
+ import { ScrollToOptions } from './scroll';
5
6
  export { UserEventConfig } from './setup';
6
7
  export declare const userEvent: {
7
8
  setup: typeof setup;
@@ -9,4 +10,5 @@ export declare const userEvent: {
9
10
  longPress: (element: ReactTestInstance, options?: PressOptions) => Promise<void>;
10
11
  type: (element: ReactTestInstance, text: string, options?: TypeOptions) => Promise<void>;
11
12
  clear: (element: ReactTestInstance) => Promise<void>;
13
+ scrollTo: (element: ReactTestInstance, options: ScrollToOptions) => Promise<void>;
12
14
  };
@@ -11,13 +11,13 @@ Object.defineProperty(exports, "UserEventConfig", {
11
11
  });
12
12
  exports.userEvent = void 0;
13
13
  var _setup = require("./setup");
14
- const userEvent = {
14
+ const userEvent = exports.userEvent = {
15
15
  setup: _setup.setup,
16
16
  // Direct access for User Event v13 compatibility
17
17
  press: element => (0, _setup.setup)().press(element),
18
18
  longPress: (element, options) => (0, _setup.setup)().longPress(element, options),
19
19
  type: (element, text, options) => (0, _setup.setup)().type(element, text, options),
20
- clear: element => (0, _setup.setup)().clear(element)
20
+ clear: element => (0, _setup.setup)().clear(element),
21
+ scrollTo: (element, options) => (0, _setup.setup)().scrollTo(element, options)
21
22
  };
22
- exports.userEvent = userEvent;
23
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_setup","require","userEvent","setup","press","element","longPress","options","type","text","clear","exports"],"sources":["../../src/user-event/index.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { setup } from './setup';\nimport { PressOptions } from './press';\nimport { TypeOptions } from './type';\n\nexport { UserEventConfig } from './setup';\n\nexport const userEvent = {\n setup,\n\n // Direct access for User Event v13 compatibility\n press: (element: ReactTestInstance) => setup().press(element),\n longPress: (element: ReactTestInstance, options?: PressOptions) =>\n setup().longPress(element, options),\n type: (element: ReactTestInstance, text: string, options?: TypeOptions) =>\n setup().type(element, text, options),\n clear: (element: ReactTestInstance) => setup().clear(element),\n};\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAMO,MAAMC,SAAS,GAAG;EACvBC,KAAK,EAALA,YAAK;EAEL;EACAC,KAAK,EAAGC,OAA0B,IAAK,IAAAF,YAAK,EAAC,CAAC,CAACC,KAAK,CAACC,OAAO,CAAC;EAC7DC,SAAS,EAAEA,CAACD,OAA0B,EAAEE,OAAsB,KAC5D,IAAAJ,YAAK,EAAC,CAAC,CAACG,SAAS,CAACD,OAAO,EAAEE,OAAO,CAAC;EACrCC,IAAI,EAAEA,CAACH,OAA0B,EAAEI,IAAY,EAAEF,OAAqB,KACpE,IAAAJ,YAAK,EAAC,CAAC,CAACK,IAAI,CAACH,OAAO,EAAEI,IAAI,EAAEF,OAAO,CAAC;EACtCG,KAAK,EAAGL,OAA0B,IAAK,IAAAF,YAAK,EAAC,CAAC,CAACO,KAAK,CAACL,OAAO;AAC9D,CAAC;AAACM,OAAA,CAAAT,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"file":"index.js","names":["_setup","require","userEvent","exports","setup","press","element","longPress","options","type","text","clear","scrollTo"],"sources":["../../src/user-event/index.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { setup } from './setup';\nimport { PressOptions } from './press';\nimport { TypeOptions } from './type';\nimport { ScrollToOptions } from './scroll';\n\nexport { UserEventConfig } from './setup';\n\nexport const userEvent = {\n setup,\n\n // Direct access for User Event v13 compatibility\n press: (element: ReactTestInstance) => setup().press(element),\n longPress: (element: ReactTestInstance, options?: PressOptions) =>\n setup().longPress(element, options),\n type: (element: ReactTestInstance, text: string, options?: TypeOptions) =>\n setup().type(element, text, options),\n clear: (element: ReactTestInstance) => setup().clear(element),\n scrollTo: (element: ReactTestInstance, options: ScrollToOptions) =>\n setup().scrollTo(element, options),\n};\n"],"mappings":";;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AAOO,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvBE,KAAK,EAALA,YAAK;EAEL;EACAC,KAAK,EAAGC,OAA0B,IAAK,IAAAF,YAAK,EAAC,CAAC,CAACC,KAAK,CAACC,OAAO,CAAC;EAC7DC,SAAS,EAAEA,CAACD,OAA0B,EAAEE,OAAsB,KAC5D,IAAAJ,YAAK,EAAC,CAAC,CAACG,SAAS,CAACD,OAAO,EAAEE,OAAO,CAAC;EACrCC,IAAI,EAAEA,CAACH,OAA0B,EAAEI,IAAY,EAAEF,OAAqB,KACpE,IAAAJ,YAAK,EAAC,CAAC,CAACK,IAAI,CAACH,OAAO,EAAEI,IAAI,EAAEF,OAAO,CAAC;EACtCG,KAAK,EAAGL,OAA0B,IAAK,IAAAF,YAAK,EAAC,CAAC,CAACO,KAAK,CAACL,OAAO,CAAC;EAC7DM,QAAQ,EAAEA,CAACN,OAA0B,EAAEE,OAAwB,KAC7D,IAAAJ,YAAK,EAAC,CAAC,CAACQ,QAAQ,CAACN,OAAO,EAAEE,OAAO;AACrC,CAAC"}
@@ -7,10 +7,8 @@ exports.DEFAULT_MIN_PRESS_DURATION = exports.DEFAULT_LONG_PRESS_DELAY_MS = void
7
7
  // These are constants defined in the React Native repo
8
8
 
9
9
  // Used to define the delay before calling onPressOut after a press
10
- const DEFAULT_MIN_PRESS_DURATION = 130;
10
+ const DEFAULT_MIN_PRESS_DURATION = exports.DEFAULT_MIN_PRESS_DURATION = 130;
11
11
 
12
12
  // Default minimum press duration to trigger a long press
13
- exports.DEFAULT_MIN_PRESS_DURATION = DEFAULT_MIN_PRESS_DURATION;
14
- const DEFAULT_LONG_PRESS_DELAY_MS = 500;
15
- exports.DEFAULT_LONG_PRESS_DELAY_MS = DEFAULT_LONG_PRESS_DELAY_MS;
13
+ const DEFAULT_LONG_PRESS_DELAY_MS = exports.DEFAULT_LONG_PRESS_DELAY_MS = 500;
16
14
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["DEFAULT_MIN_PRESS_DURATION","exports","DEFAULT_LONG_PRESS_DELAY_MS"],"sources":["../../../src/user-event/press/constants.ts"],"sourcesContent":["// These are constants defined in the React Native repo\n\n// Used to define the delay before calling onPressOut after a press\nexport const DEFAULT_MIN_PRESS_DURATION = 130;\n\n// Default minimum press duration to trigger a long press\nexport const DEFAULT_LONG_PRESS_DELAY_MS = 500;\n"],"mappings":";;;;;;AAAA;;AAEA;AACO,MAAMA,0BAA0B,GAAG,GAAG;;AAE7C;AAAAC,OAAA,CAAAD,0BAAA,GAAAA,0BAAA;AACO,MAAME,2BAA2B,GAAG,GAAG;AAACD,OAAA,CAAAC,2BAAA,GAAAA,2BAAA"}
1
+ {"version":3,"file":"constants.js","names":["DEFAULT_MIN_PRESS_DURATION","exports","DEFAULT_LONG_PRESS_DELAY_MS"],"sources":["../../../src/user-event/press/constants.ts"],"sourcesContent":["// These are constants defined in the React Native repo\n\n// Used to define the delay before calling onPressOut after a press\nexport const DEFAULT_MIN_PRESS_DURATION = 130;\n\n// Default minimum press duration to trigger a long press\nexport const DEFAULT_LONG_PRESS_DELAY_MS = 500;\n"],"mappings":";;;;;;AAAA;;AAEA;AACO,MAAMA,0BAA0B,GAAAC,OAAA,CAAAD,0BAAA,GAAG,GAAG;;AAE7C;AACO,MAAME,2BAA2B,GAAAD,OAAA,CAAAC,2BAAA,GAAG,GAAG"}
@@ -5,14 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.longPress = longPress;
7
7
  exports.press = press;
8
- var _act = _interopRequireDefault(require("../../act"));
9
8
  var _componentTree = require("../../helpers/component-tree");
9
+ var _textInput = require("../../helpers/text-input");
10
10
  var _pointerEvents = require("../../helpers/pointer-events");
11
11
  var _hostComponentNames = require("../../helpers/host-component-names");
12
12
  var _eventBuilder = require("../event-builder");
13
13
  var _utils = require("../utils");
14
14
  var _constants = require("./constants");
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
15
  async function press(element) {
17
16
  await basePress(this.config, element, {
18
17
  type: 'press',
@@ -30,7 +29,7 @@ const basePress = async (config, element, options) => {
30
29
  await emitTextPressEvents(config, element, options);
31
30
  return;
32
31
  }
33
- if ((0, _utils.isEditableTextInput)(element) && (0, _pointerEvents.isPointerEventEnabled)(element)) {
32
+ if ((0, _hostComponentNames.isHostTextInput)(element) && (0, _textInput.isTextInputEditable)(element) && (0, _pointerEvents.isPointerEventEnabled)(element)) {
34
33
  await emitTextInputPressEvents(config, element, options);
35
34
  return;
36
35
  }
@@ -47,18 +46,16 @@ const basePress = async (config, element, options) => {
47
46
  const emitPressablePressEvents = async (config, element, options) => {
48
47
  (0, _utils.warnAboutRealTimersIfNeeded)();
49
48
  await (0, _utils.wait)(config);
50
- await (0, _act.default)(async () => {
51
- (0, _utils.dispatchEvent)(element, 'responderGrant', _eventBuilder.EventBuilder.Common.responderGrant());
52
- await (0, _utils.wait)(config, options.duration);
53
- (0, _utils.dispatchEvent)(element, 'responderRelease', _eventBuilder.EventBuilder.Common.responderRelease());
49
+ (0, _utils.dispatchEvent)(element, 'responderGrant', _eventBuilder.EventBuilder.Common.responderGrant());
50
+ await (0, _utils.wait)(config, options.duration);
51
+ (0, _utils.dispatchEvent)(element, 'responderRelease', _eventBuilder.EventBuilder.Common.responderRelease());
54
52
 
55
- // React Native will wait for minimal delay of DEFAULT_MIN_PRESS_DURATION
56
- // before emitting the `pressOut` event. We need to wait here, so that
57
- // `press()` function does not return before that.
58
- if (_constants.DEFAULT_MIN_PRESS_DURATION - options.duration > 0) {
59
- await (0, _utils.wait)(config, _constants.DEFAULT_MIN_PRESS_DURATION - options.duration);
60
- }
61
- });
53
+ // React Native will wait for minimal delay of DEFAULT_MIN_PRESS_DURATION
54
+ // before emitting the `pressOut` event. We need to wait here, so that
55
+ // `press()` function does not return before that.
56
+ if (_constants.DEFAULT_MIN_PRESS_DURATION - options.duration > 0) {
57
+ await (0, _utils.wait)(config, _constants.DEFAULT_MIN_PRESS_DURATION - options.duration);
58
+ }
62
59
  };
63
60
  const isEnabledTouchResponder = element => {
64
61
  return (0, _pointerEvents.isPointerEventEnabled)(element) && element.props.onStartShouldSetResponder?.();