@testing-library/react-native 12.3.1 → 12.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/config.d.ts +1 -1
- package/build/config.js.map +1 -1
- package/build/{fireEvent.js → fire-event.js} +1 -1
- package/build/fire-event.js.map +1 -0
- package/build/helpers/{debugDeep.js → debug-deep.js} +1 -1
- package/build/helpers/debug-deep.js.map +1 -0
- package/build/helpers/{debugShallow.js → debug-shallow.js} +1 -1
- package/build/helpers/debug-shallow.js.map +1 -0
- package/build/helpers/{findAll.js → find-all.js} +1 -1
- package/build/helpers/find-all.js.map +1 -0
- package/build/helpers/format-default.js +3 -19
- package/build/helpers/format-default.js.map +1 -1
- package/build/helpers/matchers/{accessibilityState.js → match-accessibility-state.js} +1 -1
- package/build/helpers/matchers/match-accessibility-state.js.map +1 -0
- package/build/helpers/matchers/{accessibilityValue.js → match-accessibility-value.js} +2 -2
- package/build/helpers/matchers/match-accessibility-value.js.map +1 -0
- package/build/helpers/matchers/{matchArrayProp.js → match-array-prop.js} +1 -1
- package/build/helpers/matchers/match-array-prop.js.map +1 -0
- package/build/helpers/matchers/{matchLabelText.js → match-label-text.js} +3 -3
- package/build/helpers/matchers/match-label-text.js.map +1 -0
- package/build/helpers/matchers/{matchObjectProp.js → match-object-prop.js} +1 -1
- package/build/helpers/matchers/match-object-prop.js.map +1 -0
- package/build/helpers/matchers/{matchStringProp.js → match-string-prop.js} +1 -1
- package/build/helpers/matchers/match-string-prop.js.map +1 -0
- package/build/helpers/matchers/{matchTextContent.js → match-text-content.js} +1 -1
- package/build/helpers/matchers/match-text-content.js.map +1 -0
- package/build/helpers/object.d.ts +1 -0
- package/build/helpers/object.js +18 -0
- package/build/helpers/object.js.map +1 -1
- package/build/helpers/{stringValidation.js → string-validation.js} +1 -1
- package/build/helpers/string-validation.js.map +1 -0
- package/build/matchers/extend-expect.d.js.map +1 -1
- package/build/matchers/extend-expect.js +2 -0
- package/build/matchers/extend-expect.js.map +1 -1
- package/build/matchers/index.d.ts +1 -0
- package/build/matchers/index.js +7 -0
- package/build/matchers/index.js.map +1 -1
- package/build/matchers/to-have-accessibility-value.d.ts +7 -0
- package/build/matchers/to-have-accessibility-value.js +23 -0
- package/build/matchers/to-have-accessibility-value.js.map +1 -0
- package/build/pure.d.ts +5 -5
- package/build/pure.js +4 -4
- package/build/pure.js.map +1 -1
- package/build/queries/{a11yState.d.ts → accessibility-state.d.ts} +2 -2
- package/build/queries/{a11yState.js → accessibility-state.js} +5 -5
- package/build/queries/accessibility-state.js.map +1 -0
- package/build/queries/{a11yValue.d.ts → accessibility-value.d.ts} +2 -2
- package/build/queries/{a11yValue.js → accessibility-value.js} +5 -5
- package/build/queries/accessibility-value.js.map +1 -0
- package/build/queries/{displayValue.d.ts → display-value.d.ts} +1 -1
- package/build/queries/{displayValue.js → display-value.js} +3 -3
- package/build/queries/display-value.js.map +1 -0
- package/build/queries/{hintText.d.ts → hint-text.d.ts} +1 -1
- package/build/queries/{hintText.js → hint-text.js} +3 -3
- package/build/queries/hint-text.js.map +1 -0
- package/build/queries/{labelText.d.ts → label-text.d.ts} +1 -1
- package/build/queries/{labelText.js → label-text.js} +4 -4
- package/build/queries/label-text.js.map +1 -0
- package/build/queries/{makeQueries.d.ts → make-queries.d.ts} +1 -1
- package/build/queries/{makeQueries.js → make-queries.js} +2 -2
- package/build/queries/make-queries.js.map +1 -0
- package/build/queries/{placeholderText.d.ts → placeholder-text.d.ts} +1 -1
- package/build/queries/{placeholderText.js → placeholder-text.js} +3 -3
- package/build/queries/placeholder-text.js.map +1 -0
- package/build/queries/role.d.ts +3 -3
- package/build/queries/role.js +7 -7
- package/build/queries/role.js.map +1 -1
- package/build/queries/{testId.d.ts → test-id.d.ts} +1 -1
- package/build/queries/{testId.js → test-id.js} +3 -3
- package/build/queries/test-id.js.map +1 -0
- package/build/queries/text.d.ts +1 -1
- package/build/queries/text.js +3 -3
- package/build/queries/text.js.map +1 -1
- package/build/queries/{unsafeProps.js → unsafe-props.js} +1 -1
- package/build/queries/unsafe-props.js.map +1 -0
- package/build/queries/{unsafeType.js → unsafe-type.js} +1 -1
- package/build/queries/unsafe-type.js.map +1 -0
- package/build/{renderHook.js → render-hook.js} +1 -1
- package/build/render-hook.js.map +1 -0
- package/build/render.d.ts +169 -169
- package/build/render.js +3 -3
- package/build/render.js.map +1 -1
- package/build/user-event/scroll/index.d.ts +1 -1
- package/build/user-event/scroll/index.js +1 -1
- package/build/user-event/scroll/index.js.map +1 -1
- package/build/user-event/scroll/{scrollTo.js → scroll-to.js} +1 -1
- package/build/user-event/scroll/scroll-to.js.map +1 -0
- package/build/user-event/type/{parseKeys.js → parse-keys.js} +1 -1
- package/build/user-event/type/parse-keys.js.map +1 -0
- package/build/user-event/type/type.js +1 -1
- package/build/user-event/type/type.js.map +1 -1
- package/build/{waitForElementToBeRemoved.d.ts → wait-for-element-to-be-removed.d.ts} +1 -1
- package/build/{waitForElementToBeRemoved.js → wait-for-element-to-be-removed.js} +2 -2
- package/build/wait-for-element-to-be-removed.js.map +1 -0
- package/build/{waitFor.js → wait-for.js} +1 -1
- package/build/wait-for.js.map +1 -0
- package/build/within.d.ts +84 -84
- package/build/within.js +11 -11
- package/build/within.js.map +1 -1
- package/package.json +2 -1
- package/pure.d.ts +1 -0
- package/build/fireEvent.js.map +0 -1
- package/build/helpers/debugDeep.js.map +0 -1
- package/build/helpers/debugShallow.js.map +0 -1
- package/build/helpers/findAll.js.map +0 -1
- package/build/helpers/matchers/accessibilityState.js.map +0 -1
- package/build/helpers/matchers/accessibilityValue.js.map +0 -1
- package/build/helpers/matchers/matchArrayProp.js.map +0 -1
- package/build/helpers/matchers/matchLabelText.js.map +0 -1
- package/build/helpers/matchers/matchObjectProp.js.map +0 -1
- package/build/helpers/matchers/matchStringProp.js.map +0 -1
- package/build/helpers/matchers/matchTextContent.js.map +0 -1
- package/build/helpers/stringValidation.js.map +0 -1
- package/build/queries/a11yState.js.map +0 -1
- package/build/queries/a11yValue.js.map +0 -1
- package/build/queries/displayValue.js.map +0 -1
- package/build/queries/hintText.js.map +0 -1
- package/build/queries/labelText.js.map +0 -1
- package/build/queries/makeQueries.js.map +0 -1
- package/build/queries/placeholderText.js.map +0 -1
- package/build/queries/testId.js.map +0 -1
- package/build/queries/unsafeProps.js.map +0 -1
- package/build/queries/unsafeType.js.map +0 -1
- package/build/renderHook.js.map +0 -1
- package/build/user-event/scroll/scrollTo.js.map +0 -1
- package/build/user-event/type/parseKeys.js.map +0 -1
- package/build/waitFor.js.map +0 -1
- package/build/waitForElementToBeRemoved.js.map +0 -1
- /package/build/{fireEvent.d.ts → fire-event.d.ts} +0 -0
- /package/build/helpers/{debugDeep.d.ts → debug-deep.d.ts} +0 -0
- /package/build/helpers/{debugShallow.d.ts → debug-shallow.d.ts} +0 -0
- /package/build/helpers/{findAll.d.ts → find-all.d.ts} +0 -0
- /package/build/helpers/matchers/{accessibilityState.d.ts → match-accessibility-state.d.ts} +0 -0
- /package/build/helpers/matchers/{accessibilityValue.d.ts → match-accessibility-value.d.ts} +0 -0
- /package/build/helpers/matchers/{matchArrayProp.d.ts → match-array-prop.d.ts} +0 -0
- /package/build/helpers/matchers/{matchLabelText.d.ts → match-label-text.d.ts} +0 -0
- /package/build/helpers/matchers/{matchObjectProp.d.ts → match-object-prop.d.ts} +0 -0
- /package/build/helpers/matchers/{matchStringProp.d.ts → match-string-prop.d.ts} +0 -0
- /package/build/helpers/matchers/{matchTextContent.d.ts → match-text-content.d.ts} +0 -0
- /package/build/helpers/{stringValidation.d.ts → string-validation.d.ts} +0 -0
- /package/build/queries/{unsafeProps.d.ts → unsafe-props.d.ts} +0 -0
- /package/build/queries/{unsafeType.d.ts → unsafe-type.d.ts} +0 -0
- /package/build/{renderHook.d.ts → render-hook.d.ts} +0 -0
- /package/build/user-event/scroll/{scrollTo.d.ts → scroll-to.d.ts} +0 -0
- /package/build/user-event/type/{parseKeys.d.ts → parse-keys.d.ts} +0 -0
- /package/build/{waitFor.d.ts → wait-for.d.ts} +0 -0
package/build/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,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card","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/debug-deep';\nimport debugShallow from './helpers/debug-shallow';\nimport { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';\nimport { validateStringsRenderedWithinText } from './helpers/string-validation';\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,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GA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MAAM,IAAIsD,KAAK,CACb,6DAA6D,GAC3D,iEACJ,CAAC;IACH;EACF,CAAC,CAAC;EAEF,IAAAC,uBAAe,EAACR,MAAM,CAAC;EACvB,OAAOA,MAAM;AACf;AAEA,SAASN,aAAaA,CACpBd,QAA2B,EAC3BH,IAA8D,EAC9D;EACA,OAAO,UAAUV,SAA6B,EAAE;IAC9C,IAAA+B,YAAG,EAAC,MAAM;MACRlB,QAAQ,CAACa,MAAM,CAAChB,IAAI,CAACV,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC;EACJ,CAAC;AACH;AAOA,SAASoC,KAAKA,CACZR,QAA2B,EAC3Bf,QAA2B,EACZ;EACf,SAAS6B,SAASA,CAACzC,OAA+B,EAAE;IAClD,MAAM;MAAE0C;IAAoB,CAAC,GAAG,IAAAC,iBAAS,EAAC,CAAC;IAC3C,MAAMC,YAAY,GAChB,OAAO5C,OAAO,KAAK,QAAQ,GACvB;MAAE,GAAG0C,mBAAmB;MAAEG,OAAO,EAAE7C;IAAQ,CAAC,GAC5C;MAAE,GAAG0C,mBAAmB;MAAE,GAAG1C;IAAQ,CAAC;IAE5C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B;MACA8C,OAAO,CAACC,IAAI,CACV,+HACF,CAAC;IACH;IAEA,MAAMC,IAAI,GAAGpC,QAAQ,CAACS,MAAM,CAAC,CAAC;IAC9B,IAAI2B,IAAI,EAAE;MACR,OAAO,IAAAC,kBAAS,EAACD,IAAI,EAAEJ,YAAY,CAAC;IACtC;EACF;EACAH,SAAS,CAACS,OAAO,GAAIL,OAAgB,IAAK,IAAAM,qBAAY,EAACxB,QAAQ,EAAEkB,OAAO,CAAC;EACzE,OAAOJ,SAAS;AAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ScrollToOptions, scrollTo } from './
|
|
1
|
+
export { ScrollToOptions, scrollTo } from './scroll-to';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_scrollTo","require"],"sources":["../../../src/user-event/scroll/index.ts"],"sourcesContent":["export { ScrollToOptions, scrollTo } from './
|
|
1
|
+
{"version":3,"file":"index.js","names":["_scrollTo","require"],"sources":["../../../src/user-event/scroll/index.ts"],"sourcesContent":["export { ScrollToOptions, scrollTo } from './scroll-to';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA"}
|
|
@@ -79,4 +79,4 @@ function ensureScrollViewDirection(element, options) {
|
|
|
79
79
|
throw new _errors.ErrorWithStack(`scrollTo() expected only horizontal scroll options: "x" and "momentumX" for horizontal "ScrollView" element but received ${(0, _jestMatcherUtils.stringify)((0, _object.pick)(options, ['y', 'momentumY']))}`, scrollTo);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
//# sourceMappingURL=
|
|
82
|
+
//# sourceMappingURL=scroll-to.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-to.js","names":["_jestMatcherUtils","require","_eventBuilder","_errors","_hostComponentNames","_object","_utils","_utils2","_state","scrollTo","element","options","isHostScrollView","ErrorWithStack","type","ensureScrollViewDirection","initialPosition","getElementScrollOffset","dragSteps","createScrollSteps","y","x","linearInterpolator","emitDragScrollEvents","config","momentumStart","at","momentumSteps","momentumY","momentumX","inertialInterpolator","emitMomentumScrollEvents","finalPosition","setElementScrollOffset","scrollSteps","length","wait","dispatchEvent","EventBuilder","ScrollView","scroll","i","lastStep","isVerticalScrollView","props","horizontal","hasHorizontalScrollOptions","undefined","stringify","pick","hasVerticalScrollOptions"],"sources":["../../../src/user-event/scroll/scroll-to.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { stringify } from 'jest-matcher-utils';\nimport { UserEventConfig, UserEventInstance } from '../setup';\nimport { EventBuilder } from '../event-builder';\nimport { ErrorWithStack } from '../../helpers/errors';\nimport { isHostScrollView } from '../../helpers/host-component-names';\nimport { pick } from '../../helpers/object';\nimport { dispatchEvent, wait } from '../utils';\nimport { ContentOffset } from '../event-builder/scroll-view';\nimport {\n createScrollSteps,\n inertialInterpolator,\n linearInterpolator,\n} from './utils';\nimport { getElementScrollOffset, setElementScrollOffset } from './state';\n\nexport interface VerticalScrollToOptions {\n y: number;\n momentumY?: number;\n\n // Vertical scroll should not contain horizontal scroll part.\n x?: never;\n momentumX?: never;\n}\n\nexport interface HorizontalScrollToOptions {\n x: number;\n momentumX?: number;\n\n // Horizontal scroll should not contain vertical scroll part.\n y?: never;\n momentumY?: never;\n}\n\nexport type ScrollToOptions =\n | VerticalScrollToOptions\n | HorizontalScrollToOptions;\n\nexport async function scrollTo(\n this: UserEventInstance,\n element: ReactTestInstance,\n options: ScrollToOptions\n): Promise<void> {\n if (!isHostScrollView(element)) {\n throw new ErrorWithStack(\n `scrollTo() works only with host \"ScrollView\" elements. Passed element has type \"${element.type}\".`,\n scrollTo\n );\n }\n\n ensureScrollViewDirection(element, options);\n\n const initialPosition = getElementScrollOffset(element);\n const dragSteps = createScrollSteps(\n { y: options.y, x: options.x },\n initialPosition,\n linearInterpolator\n );\n await emitDragScrollEvents(this.config, element, dragSteps);\n\n const momentumStart = dragSteps.at(-1) ?? initialPosition;\n const momentumSteps = createScrollSteps(\n { y: options.momentumY, x: options.momentumX },\n momentumStart,\n inertialInterpolator\n );\n await emitMomentumScrollEvents(this.config, element, momentumSteps);\n\n const finalPosition =\n momentumSteps.at(-1) ?? dragSteps.at(-1) ?? initialPosition;\n setElementScrollOffset(element, finalPosition);\n}\n\nasync function emitDragScrollEvents(\n config: UserEventConfig,\n element: ReactTestInstance,\n scrollSteps: ContentOffset[]\n) {\n if (scrollSteps.length === 0) {\n return;\n }\n\n await wait(config);\n dispatchEvent(\n element,\n 'scrollBeginDrag',\n EventBuilder.ScrollView.scroll(scrollSteps[0])\n );\n\n // Note: experimentally, in case of drag scroll the last scroll step\n // will not trigger `scroll` event.\n // See: https://github.com/callstack/react-native-testing-library/wiki/ScrollView-Events\n for (let i = 1; i < scrollSteps.length - 1; i += 1) {\n await wait(config);\n dispatchEvent(\n element,\n 'scroll',\n EventBuilder.ScrollView.scroll(scrollSteps[i])\n );\n }\n\n await wait(config);\n const lastStep = scrollSteps.at(-1);\n dispatchEvent(\n element,\n 'scrollEndDrag',\n EventBuilder.ScrollView.scroll(lastStep)\n );\n}\n\nasync function emitMomentumScrollEvents(\n config: UserEventConfig,\n element: ReactTestInstance,\n scrollSteps: ContentOffset[]\n) {\n if (scrollSteps.length === 0) {\n return;\n }\n\n await wait(config);\n dispatchEvent(\n element,\n 'momentumScrollBegin',\n EventBuilder.ScrollView.scroll(scrollSteps[0])\n );\n\n // Note: experimentally, in case of momentum scroll the last scroll step\n // will trigger `scroll` event.\n // See: https://github.com/callstack/react-native-testing-library/wiki/ScrollView-Events\n for (let i = 1; i < scrollSteps.length; i += 1) {\n await wait(config);\n dispatchEvent(\n element,\n 'scroll',\n EventBuilder.ScrollView.scroll(scrollSteps[i])\n );\n }\n\n await wait(config);\n const lastStep = scrollSteps.at(-1);\n dispatchEvent(\n element,\n 'momentumScrollEnd',\n EventBuilder.ScrollView.scroll(lastStep)\n );\n}\n\nfunction ensureScrollViewDirection(\n element: ReactTestInstance,\n options: ScrollToOptions\n) {\n const isVerticalScrollView = element.props.horizontal !== true;\n\n const hasHorizontalScrollOptions =\n options.x !== undefined || options.momentumX !== undefined;\n if (isVerticalScrollView && hasHorizontalScrollOptions) {\n throw new ErrorWithStack(\n `scrollTo() expected only vertical scroll options: \"y\" and \"momentumY\" for vertical \"ScrollView\" element but received ${stringify(\n pick(options, ['x', 'momentumX'])\n )}`,\n scrollTo\n );\n }\n\n const hasVerticalScrollOptions =\n options.y !== undefined || options.momentumY !== undefined;\n if (!isVerticalScrollView && hasVerticalScrollOptions) {\n throw new ErrorWithStack(\n `scrollTo() expected only horizontal scroll options: \"x\" and \"momentumX\" for horizontal \"ScrollView\" element but received ${stringify(\n pick(options, ['y', 'momentumY'])\n )}`,\n scrollTo\n );\n }\n}\n"],"m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mC,2BAAS,EACnI,IAAAC,YAAI,EAACtC,OAAO,EAAE,CAAC,GAAG,EAAE,WAAW,CAAC,CAClC,CAAE,EAAC,EACHF,QACF,CAAC;EACH;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-keys.js","names":["knownKeys","Set","parseKeys","text","result","remainingText","token","rest","getNextToken","length","has","Error","push","slice","endIndex","indexOf"],"sources":["../../../src/user-event/type/parse-keys.ts"],"sourcesContent":["const knownKeys = new Set(['Enter', 'Backspace']);\n\nexport function parseKeys(text: string) {\n const result = [];\n\n let remainingText = text;\n while (remainingText) {\n const [token, rest] = getNextToken(remainingText);\n if (token.length > 1 && !knownKeys.has(token)) {\n throw new Error(`Unknown key \"${token}\" in \"${text}\"`);\n }\n\n result.push(token);\n remainingText = rest;\n }\n\n return result;\n}\n\nfunction getNextToken(text: string): [string, string] {\n // Detect `{{` => escaped `{`\n if (text[0] === '{' && text[1] === '{') {\n return ['{', text.slice(2)];\n }\n\n // Detect `{key}` => special key\n if (text[0] === '{') {\n const endIndex = text.indexOf('}');\n if (endIndex === -1) {\n throw new Error(`Invalid key sequence \"${text}\"`);\n }\n\n return [text.slice(1, endIndex), text.slice(endIndex + 1)];\n }\n\n if (text[0] === '\\n') {\n return ['Enter', text.slice(1)];\n }\n\n return [text[0], text.slice(1)];\n}\n"],"mappings":";;;;;;AAAA,MAAMA,SAAS,GAAG,IAAIC,GAAG,CAAC,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;AAE1C,SAASC,SAASA,CAACC,IAAY,EAAE;EACtC,MAAMC,MAAM,GAAG,EAAE;EAEjB,IAAIC,aAAa,GAAGF,IAAI;EACxB,OAAOE,aAAa,EAAE;IACpB,MAAM,CAACC,KAAK,EAAEC,IAAI,CAAC,GAAGC,YAAY,CAACH,aAAa,CAAC;IACjD,IAAIC,KAAK,CAACG,MAAM,GAAG,CAAC,IAAI,CAACT,SAAS,CAACU,GAAG,CAACJ,KAAK,CAAC,EAAE;MAC7C,MAAM,IAAIK,KAAK,CAAE,gBAAeL,KAAM,SAAQH,IAAK,GAAE,CAAC;IACxD;IAEAC,MAAM,CAACQ,IAAI,CAACN,KAAK,CAAC;IAClBD,aAAa,GAAGE,IAAI;EACtB;EAEA,OAAOH,MAAM;AACf;AAEA,SAASI,YAAYA,CAACL,IAAY,EAAoB;EACpD;EACA,IAAIA,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,IAAIA,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IACtC,OAAO,CAAC,GAAG,EAAEA,IAAI,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC;EAC7B;;EAEA;EACA,IAAIV,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;IACnB,MAAMW,QAAQ,GAAGX,IAAI,CAACY,OAAO,CAAC,GAAG,CAAC;IAClC,IAAID,QAAQ,KAAK,CAAC,CAAC,EAAE;MACnB,MAAM,IAAIH,KAAK,CAAE,yBAAwBR,IAAK,GAAE,CAAC;IACnD;IAEA,OAAO,CAACA,IAAI,CAACU,KAAK,CAAC,CAAC,EAAEC,QAAQ,CAAC,EAAEX,IAAI,CAACU,KAAK,CAACC,QAAQ,GAAG,CAAC,CAAC,CAAC;EAC5D;EAEA,IAAIX,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE;IACpB,OAAO,CAAC,OAAO,EAAEA,IAAI,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC;EACjC;EAEA,OAAO,CAACV,IAAI,CAAC,CAAC,CAAC,EAAEA,IAAI,CAACU,KAAK,CAAC,CAAC,CAAC,CAAC;AACjC"}
|
|
@@ -11,7 +11,7 @@ var _errors = require("../../helpers/errors");
|
|
|
11
11
|
var _textInput = require("../../helpers/text-input");
|
|
12
12
|
var _pointerEvents = require("../../helpers/pointer-events");
|
|
13
13
|
var _utils = require("../utils");
|
|
14
|
-
var _parseKeys = require("./
|
|
14
|
+
var _parseKeys = require("./parse-keys");
|
|
15
15
|
async function type(element, text, options) {
|
|
16
16
|
if (!(0, _hostComponentNames.isHostTextInput)(element)) {
|
|
17
17
|
throw new _errors.ErrorWithStack(`type() works only with host "TextInput" elements. Passed element has type "${element.type}".`, type);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","names":["_hostComponentNames","require","_eventBuilder","_errors","_textInput","_pointerEvents","_utils","_parseKeys","type","element","text","options","isHostTextInput","ErrorWithStack","isTextInputEditable","isPointerEventEnabled","keys","parseKeys","skipPress","dispatchEvent","EventBuilder","Common","touch","focus","wait","config","currentText","props","value","defaultValue","key","previousText","applyKey","emitTypingEvents","finalText","submitEditing","TextInput","endEditing","blur","isMultiline","multiline","keyPress","textInput","change","selectionRange","start","length","end","selectionChange","contentSize","getTextContentSize","contentSizeChange","slice"],"sources":["../../../src/user-event/type/type.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { isHostTextInput } from '../../helpers/host-component-names';\nimport { EventBuilder } from '../event-builder';\nimport { ErrorWithStack } from '../../helpers/errors';\nimport { isTextInputEditable } from '../../helpers/text-input';\nimport { isPointerEventEnabled } from '../../helpers/pointer-events';\nimport { UserEventConfig, UserEventInstance } from '../setup';\nimport { dispatchEvent, wait, getTextContentSize } from '../utils';\nimport { parseKeys } from './
|
|
1
|
+
{"version":3,"file":"type.js","names":["_hostComponentNames","require","_eventBuilder","_errors","_textInput","_pointerEvents","_utils","_parseKeys","type","element","text","options","isHostTextInput","ErrorWithStack","isTextInputEditable","isPointerEventEnabled","keys","parseKeys","skipPress","dispatchEvent","EventBuilder","Common","touch","focus","wait","config","currentText","props","value","defaultValue","key","previousText","applyKey","emitTypingEvents","finalText","submitEditing","TextInput","endEditing","blur","isMultiline","multiline","keyPress","textInput","change","selectionRange","start","length","end","selectionChange","contentSize","getTextContentSize","contentSizeChange","slice"],"sources":["../../../src/user-event/type/type.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { isHostTextInput } from '../../helpers/host-component-names';\nimport { EventBuilder } from '../event-builder';\nimport { ErrorWithStack } from '../../helpers/errors';\nimport { isTextInputEditable } from '../../helpers/text-input';\nimport { isPointerEventEnabled } from '../../helpers/pointer-events';\nimport { UserEventConfig, UserEventInstance } from '../setup';\nimport { dispatchEvent, wait, getTextContentSize } from '../utils';\nimport { parseKeys } from './parse-keys';\n\nexport interface TypeOptions {\n skipPress?: boolean;\n submitEditing?: boolean;\n}\n\nexport async function type(\n this: UserEventInstance,\n element: ReactTestInstance,\n text: string,\n options?: TypeOptions\n): Promise<void> {\n if (!isHostTextInput(element)) {\n throw new ErrorWithStack(\n `type() works only with host \"TextInput\" elements. Passed element has type \"${element.type}\".`,\n type\n );\n }\n\n // Skip events if the element is disabled\n if (!isTextInputEditable(element) || !isPointerEventEnabled(element)) {\n return;\n }\n\n const keys = parseKeys(text);\n\n if (!options?.skipPress) {\n dispatchEvent(element, 'pressIn', EventBuilder.Common.touch());\n }\n\n dispatchEvent(element, 'focus', EventBuilder.Common.focus());\n\n if (!options?.skipPress) {\n await wait(this.config);\n dispatchEvent(element, 'pressOut', EventBuilder.Common.touch());\n }\n\n let currentText = element.props.value ?? element.props.defaultValue ?? '';\n for (const key of keys) {\n const previousText = element.props.value ?? currentText;\n currentText = applyKey(previousText, key);\n\n await emitTypingEvents(\n this.config,\n element,\n key,\n currentText,\n previousText\n );\n }\n\n const finalText = element.props.value ?? currentText;\n await wait(this.config);\n\n if (options?.submitEditing) {\n dispatchEvent(\n element,\n 'submitEditing',\n EventBuilder.TextInput.submitEditing(finalText)\n );\n }\n\n dispatchEvent(\n element,\n 'endEditing',\n EventBuilder.TextInput.endEditing(finalText)\n );\n\n dispatchEvent(element, 'blur', EventBuilder.Common.blur());\n}\n\nexport async function emitTypingEvents(\n config: UserEventConfig,\n element: ReactTestInstance,\n key: string,\n currentText: string,\n previousText: string\n) {\n const isMultiline = element.props.multiline === true;\n\n await wait(config);\n dispatchEvent(element, 'keyPress', EventBuilder.TextInput.keyPress(key));\n\n // According to the docs only multiline TextInput emits textInput event\n // @see: https://github.com/facebook/react-native/blob/42a2898617da1d7a98ef574a5b9e500681c8f738/packages/react-native/Libraries/Components/TextInput/TextInput.d.ts#L754\n if (isMultiline) {\n dispatchEvent(\n element,\n 'textInput',\n EventBuilder.TextInput.textInput(currentText, previousText)\n );\n }\n\n dispatchEvent(element, 'change', EventBuilder.TextInput.change(currentText));\n dispatchEvent(element, 'changeText', currentText);\n\n const selectionRange = {\n start: currentText.length,\n end: currentText.length,\n };\n dispatchEvent(\n element,\n 'selectionChange',\n EventBuilder.TextInput.selectionChange(selectionRange)\n );\n\n // According to the docs only multiline TextInput emits contentSizeChange event\n // @see: https://reactnative.dev/docs/textinput#oncontentsizechange\n if (isMultiline) {\n const contentSize = getTextContentSize(currentText);\n dispatchEvent(\n element,\n 'contentSizeChange',\n EventBuilder.TextInput.contentSizeChange(contentSize)\n );\n }\n}\n\nfunction applyKey(text: string, key: string) {\n if (key === 'Enter') {\n return `${text}\\n`;\n }\n\n if (key === 'Backspace') {\n return text.slice(0, -1);\n }\n\n return text + key;\n}\n"],"mappings":";;;;;;;AACA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AAEA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAOO,eAAeO,IAAIA,CAExBC,OAA0B,EAC1BC,IAAY,EACZC,OAAqB,EACN;EACf,IAAI,CAAC,IAAAC,mCAAe,EAACH,OAAO,CAAC,EAAE;IAC7B,MAAM,IAAII,sBAAc,CACrB,8EAA6EJ,OAAO,CAACD,IAAK,IAAG,EAC9FA,IACF,CAAC;EACH;;EAEA;EACA,IAAI,CAAC,IAAAM,8BAAmB,EAACL,OAAO,CAAC,IAAI,CAAC,IAAAM,oCAAqB,EAACN,OAAO,CAAC,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AAY,CAACgB,SAAS,CAACe,iBAAiB,CAACF,WAAW,CACtD,CAAC;EACH;AACF;AAEA,SAASjB,QAAQA,CAACtB,IAAY,EAAEoB,GAAW,EAAE;EAC3C,IAAIA,GAAG,KAAK,OAAO,EAAE;IACnB,OAAQ,GAAEpB,IAAK,IAAG;EACpB;EAEA,IAAIoB,GAAG,KAAK,WAAW,EAAE;IACvB,OAAOpB,IAAI,CAAC0C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;EAC1B;EAEA,OAAO1C,IAAI,GAAGoB,GAAG;AACnB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { WaitForOptions } from './
|
|
1
|
+
import type { WaitForOptions } from './wait-for';
|
|
2
2
|
export default function waitForElementToBeRemoved<T>(expectation: () => T, options?: WaitForOptions): Promise<T>;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = waitForElementToBeRemoved;
|
|
7
|
-
var _waitFor = _interopRequireDefault(require("./
|
|
7
|
+
var _waitFor = _interopRequireDefault(require("./wait-for"));
|
|
8
8
|
var _errors = require("./helpers/errors");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
function isRemoved(result) {
|
|
@@ -32,4 +32,4 @@ async function waitForElementToBeRemoved(expectation, options) {
|
|
|
32
32
|
return initialElements;
|
|
33
33
|
}, options);
|
|
34
34
|
}
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=wait-for-element-to-be-removed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for-element-to-be-removed.js","names":["_waitFor","_interopRequireDefault","require","_errors","obj","__esModule","default","isRemoved","result","Array","isArray","length","waitForElementToBeRemoved","expectation","options","timeoutError","ErrorWithStack","initialElements","waitFor","error"],"sources":["../src/wait-for-element-to-be-removed.ts"],"sourcesContent":["import waitFor from './wait-for';\nimport type { WaitForOptions } from './wait-for';\nimport { ErrorWithStack } from './helpers/errors';\n\nfunction isRemoved<T>(result: T): boolean {\n return !result || (Array.isArray(result) && !result.length);\n}\n\nexport default async function waitForElementToBeRemoved<T>(\n expectation: () => T,\n options?: WaitForOptions\n): Promise<T> {\n // Created here so we get a nice stacktrace\n const timeoutError = new ErrorWithStack(\n 'Timed out in waitForElementToBeRemoved.',\n waitForElementToBeRemoved\n );\n\n // Elements have to be present initally and then removed.\n const initialElements = expectation();\n if (isRemoved(initialElements)) {\n throw new ErrorWithStack(\n 'The element(s) given to waitForElementToBeRemoved are already removed. waitForElementToBeRemoved requires that the element(s) exist(s) before waiting for removal.',\n waitForElementToBeRemoved\n );\n }\n\n return waitFor(() => {\n let result;\n try {\n result = expectation();\n } catch (error) {\n return initialElements;\n }\n\n if (!isRemoved(result)) {\n throw timeoutError;\n }\n\n return initialElements;\n }, options);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAAkD,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElD,SAASG,SAASA,CAAIC,MAAS,EAAW;EACxC,OAAO,CAACA,MAAM,IAAKC,KAAK,CAACC,OAAO,CAACF,MAAM,CAAC,IAAI,CAACA,MAAM,CAACG,MAAO;AAC7D;AAEe,eAAeC,yBAAyBA,CACrDC,WAAoB,EACpBC,OAAwB,EACZ;EACZ;EACA,MAAMC,YAAY,GAAG,IAAIC,sBAAc,CACrC,yCAAyC,EACzCJ,yBACF,CAAC;;EAED;EACA,MAAMK,eAAe,GAAGJ,WAAW,CAAC,CAAC;EACrC,IAAIN,SAAS,CAACU,eAAe,CAAC,EAAE;IAC9B,MAAM,IAAID,sBAAc,CACtB,oKAAoK,EACpKJ,yBACF,CAAC;EACH;EAEA,OAAO,IAAAM,gBAAO,EAAC,MAAM;IACnB,IAAIV,MAAM;IACV,IAAI;MACFA,MAAM,GAAGK,WAAW,CAAC,CAAC;IACxB,CAAC,CAAC,OAAOM,KAAK,EAAE;MACd,OAAOF,eAAe;IACxB;IAEA,IAAI,CAACV,SAAS,CAACC,MAAM,CAAC,EAAE;MACtB,MAAMO,YAAY;IACpB;IAEA,OAAOE,eAAe;EACxB,CAAC,EAAEH,OAAO,CAAC;AACb"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wait-for.js","names":["_config","require","_flushMicroTasks","_errors","_timers","_wrapAsync","DEFAULT_INTERVAL","waitForInternal","expectation","timeout","getConfig","asyncUtilTimeout","interval","stackTraceError","onTimeout","TypeError","Promise","resolve","reject","lastError","intervalId","finished","promiseStatus","overallTimeoutTimer","usingFakeTimers","jestFakeTimersAreEnabled","checkExpectation","fakeTimeRemaining","error","Error","copyStackTrace","handleTimeout","jest","advanceTimersByTime","flushMicroTasks","setTimeout","setInterval","checkRealTimersCallback","onDone","done","clearTimeout","clearInterval","type","result","then","promiseResult","resolvedValue","rejectedValue","String","waitFor","options","ErrorWithStack","optionsWithStackTrace","wrapAsync"],"sources":["../src/wait-for.ts"],"sourcesContent":["/* globals jest */\nimport { getConfig } from './config';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { ErrorWithStack, copyStackTrace } from './helpers/errors';\nimport {\n setTimeout,\n clearTimeout,\n jestFakeTimersAreEnabled,\n} from './helpers/timers';\nimport { wrapAsync } from './helpers/wrap-async';\n\nconst DEFAULT_INTERVAL = 50;\n\nexport type WaitForOptions = {\n timeout?: number;\n interval?: number;\n stackTraceError?: ErrorWithStack;\n onTimeout?: (error: Error) => Error;\n};\n\nfunction waitForInternal<T>(\n expectation: () => T,\n {\n timeout = getConfig().asyncUtilTimeout,\n interval = DEFAULT_INTERVAL,\n stackTraceError,\n onTimeout,\n }: WaitForOptions\n): Promise<T> {\n if (typeof expectation !== 'function') {\n throw new TypeError('Received `expectation` arg must be a function');\n }\n\n // eslint-disable-next-line no-async-promise-executor\n return new Promise(async (resolve, reject) => {\n let lastError: unknown, intervalId: ReturnType<typeof setTimeout>;\n let finished = false;\n let promiseStatus = 'idle';\n\n let overallTimeoutTimer: NodeJS.Timeout | null = null;\n\n const usingFakeTimers = jestFakeTimersAreEnabled();\n\n if (usingFakeTimers) {\n checkExpectation();\n // this is a dangerous rule to disable because it could lead to an\n // infinite loop. However, eslint isn't smart enough to know that we're\n // setting finished inside `onDone` which will be called when we're done\n // waiting or when we've timed out.\n // eslint-disable-next-line no-unmodified-loop-condition\n let fakeTimeRemaining = timeout;\n while (!finished) {\n if (!jestFakeTimersAreEnabled()) {\n const error = new Error(\n `Changed from using fake timers to real timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to real timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830`\n );\n if (stackTraceError) {\n copyStackTrace(error, stackTraceError);\n }\n reject(error);\n return;\n }\n\n // when fake timers are used we want to simulate the interval time passing\n if (fakeTimeRemaining <= 0) {\n handleTimeout();\n return;\n } else {\n fakeTimeRemaining -= interval;\n }\n\n // we *could* (maybe should?) use `advanceTimersToNextTimer` but it's\n // possible that could make this loop go on forever if someone is using\n // third party code that's setting up recursive timers so rapidly that\n // the user's timer's don't get a chance to resolve. So we'll advance\n // by an interval instead. (We have a test for this case).\n jest.advanceTimersByTime(interval);\n\n // It's really important that checkExpectation is run *before* we flush\n // in-flight promises. To be honest, I'm not sure why, and I can't quite\n // think of a way to reproduce the problem in a test, but I spent\n // an entire day banging my head against a wall on this.\n checkExpectation();\n\n // In this rare case, we *need* to wait for in-flight promises\n // to resolve before continuing. We don't need to take advantage\n // of parallelization so we're fine.\n // https://stackoverflow.com/a/59243586/971592\n // eslint-disable-next-line no-await-in-loop\n await flushMicroTasks();\n }\n } else {\n overallTimeoutTimer = setTimeout(handleTimeout, timeout);\n intervalId = setInterval(checkRealTimersCallback, interval);\n checkExpectation();\n }\n\n function onDone(\n done: { type: 'result'; result: T } | { type: 'error'; error: unknown }\n ) {\n finished = true;\n if (overallTimeoutTimer) {\n clearTimeout(overallTimeoutTimer);\n }\n\n if (!usingFakeTimers) {\n clearInterval(intervalId);\n }\n\n if (done.type === 'error') {\n reject(done.error);\n } else {\n resolve(done.result);\n }\n }\n\n function checkRealTimersCallback() {\n if (jestFakeTimersAreEnabled()) {\n const error = new Error(\n `Changed from using real timers to fake timers while using waitFor. This is not allowed and will result in very strange behavior. Please ensure you're awaiting all async things your test is doing before changing to fake timers. For more info, please go to https://github.com/testing-library/dom-testing-library/issues/830`\n );\n if (stackTraceError) {\n copyStackTrace(error, stackTraceError);\n }\n return reject(error);\n } else {\n return checkExpectation();\n }\n }\n\n function checkExpectation() {\n if (promiseStatus === 'pending') return;\n try {\n const result = expectation();\n\n // @ts-ignore result can be a promise\n // eslint-disable-next-line promise/prefer-await-to-then\n if (typeof result?.then === 'function') {\n const promiseResult: Promise<T> = result as any;\n promiseStatus = 'pending';\n // eslint-disable-next-line promise/catch-or-return, promise/prefer-await-to-then\n promiseResult.then(\n (resolvedValue) => {\n promiseStatus = 'resolved';\n onDone({ type: 'result', result: resolvedValue });\n return;\n },\n (rejectedValue) => {\n promiseStatus = 'rejected';\n lastError = rejectedValue;\n return;\n }\n );\n } else {\n onDone({ type: 'result', result: result });\n }\n // If `callback` throws, wait for the next mutation, interval, or timeout.\n } catch (error) {\n // Save the most recent callback error to reject the promise with it in the event of a timeout\n lastError = error;\n }\n }\n\n function handleTimeout() {\n let error: Error;\n if (lastError) {\n if (lastError instanceof Error) {\n error = lastError;\n } else {\n error = new Error(String(lastError));\n }\n\n if (stackTraceError) {\n copyStackTrace(error, stackTraceError);\n }\n } else {\n error = new Error('Timed out in waitFor.');\n if (stackTraceError) {\n copyStackTrace(error, stackTraceError);\n }\n }\n if (typeof onTimeout === 'function') {\n const result = onTimeout(error);\n if (result) {\n error = result;\n }\n }\n onDone({ type: 'error', error });\n }\n });\n}\n\nexport default async function waitFor<T>(\n expectation: () => T,\n options?: WaitForOptions\n): Promise<T> {\n // Being able to display a useful stack trace requires generating it before doing anything async\n const stackTraceError = new ErrorWithStack('STACK_TRACE_ERROR', waitFor);\n const optionsWithStackTrace = { stackTraceError, ...options };\n\n return wrapAsync(() => waitForInternal(expectation, optionsWithStackTrace));\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,UAAA,GAAAJ,OAAA;AATA;;AAWA,MAAMK,gBAAgB,GAAG,EAAE;AAS3B,SAASC,eAAeA,CACtBC,WAAoB,EACpB;EACEC,OAAO,GAAG,IAAAC,iBAAS,EAAC,CAAC,CAACC,gBAAgB;EACtCC,QAAQ,GAAGN,gBAAgB;EAC3BO,eAAe;EACfC;AACc,CAAC,EACL;EACZ,IAAI,OAAON,WAAW,KAAK,UAAU,EAAE;IACrC,MAAM,IAAIO,SAAS,CAAC,+CAA+C,CAAC;EACtE;;EAEA;EACA,OAAO,IAAIC,OAAO,CAAC,OAAOC,OAAO,EAAEC,MAAM,KAAK;IAC5C,IAAIC,SAAkB,EAAEC,UAAyC;IACjE,IAAIC,QAAQ,GAAG,KAAK;IACpB,IAAIC,aAAa,GAAG,MAAM;IAE1B,IAAIC,mBAA0C,GAAG,IAAI;IAErD,MAAMC,eAAe,GAAG,IAAAC,gCAAwB,EAAC,CAAC;IAElD,IAAID,eAAe,EAAE;MACnBE,gBAAgB,CAAC,CAAC;MAClB;MACA;MACA;MACA;MACA;MACA,IAAIC,iBAAiB,GAAGlB,OAAO;MAC/B,OAAO,CAACY,QAAQ,EAAE;QAChB,IAAI,CAAC,IAAAI,gCAAwB,EAAC,CAAC,EAAE;UAC/B,MAAMG,KAAK,GAAG,IAAIC,KAAK,CACpB,kUACH,CAAC;UACD,IAAI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;UACnB,IAAAiB,sBAAc,EAACF,KAAK,EAAEf,eAAe,CAAC;QACxC;MACF;MACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;QACnC,MAAM6B,MAAM,GAAG7B,SAAS,CAACc,KAAK,CAAC;QAC/B,IAAIe,MAAM,EAAE;UACVf,KAAK,GAAGe,MAAM;QAChB;MACF;MACAL,MAAM,CAAC;QAAEI,IAAI,EAAE,OAAO;QAAEd;MAAM,CAAC,CAAC;IAClC;EACF,CAAC,CAAC;AACJ;AAEe,eAAeqB,OAAOA,CACnCzC,WAAoB,EACpB0C,OAAwB,EACZ;EACZ;EACA,MAAMrC,eAAe,GAAG,IAAIsC,sBAAc,CAAC,mBAAmB,EAAEF,OAAO,CAAC;EACxE,MAAMG,qBAAqB,GAAG;IAAEvC,eAAe;IAAE,GAAGqC;EAAQ,CAAC;EAE7D,OAAO,IAAAG,oBAAS,EAAC,MAAM9C,eAAe,CAACC,WAAW,EAAE4C,qBAAqB,CAAC,CAAC;AAC7E"}
|
package/build/within.d.ts
CHANGED
|
@@ -17,101 +17,101 @@ export declare function within(instance: ReactTestInstance): {
|
|
|
17
17
|
UNSAFE_getAllByType: <P_1>(type: import("react").ComponentType<P_1>) => ReactTestInstance[];
|
|
18
18
|
UNSAFE_queryByType: <P_2>(type: import("react").ComponentType<P_2>) => ReactTestInstance | null;
|
|
19
19
|
UNSAFE_queryAllByType: <P_3>(type: import("react").ComponentType<P_3>) => ReactTestInstance[];
|
|
20
|
-
getByA11yValue: import("./queries/
|
|
21
|
-
getAllByA11yValue: import("./queries/
|
|
22
|
-
queryByA11yValue: import("./queries/
|
|
23
|
-
queryAllByA11yValue: import("./queries/
|
|
24
|
-
findByA11yValue: import("./queries/
|
|
25
|
-
findAllByA11yValue: import("./queries/
|
|
26
|
-
getByAccessibilityValue: import("./queries/
|
|
27
|
-
getAllByAccessibilityValue: import("./queries/
|
|
28
|
-
queryByAccessibilityValue: import("./queries/
|
|
29
|
-
queryAllByAccessibilityValue: import("./queries/
|
|
30
|
-
findByAccessibilityValue: import("./queries/
|
|
31
|
-
findAllByAccessibilityValue: import("./queries/
|
|
32
|
-
getByA11yState: import("./queries/
|
|
33
|
-
getAllByA11yState: import("./queries/
|
|
34
|
-
queryByA11yState: import("./queries/
|
|
35
|
-
queryAllByA11yState: import("./queries/
|
|
36
|
-
findByA11yState: import("./queries/
|
|
37
|
-
findAllByA11yState: import("./queries/
|
|
38
|
-
getByAccessibilityState: import("./queries/
|
|
39
|
-
getAllByAccessibilityState: import("./queries/
|
|
40
|
-
queryByAccessibilityState: import("./queries/
|
|
41
|
-
queryAllByAccessibilityState: import("./queries/
|
|
42
|
-
findByAccessibilityState: import("./queries/
|
|
43
|
-
findAllByAccessibilityState: import("./queries/
|
|
44
|
-
getByRole: import("./queries/
|
|
20
|
+
getByA11yValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
21
|
+
getAllByA11yValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
22
|
+
queryByA11yValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
23
|
+
queryAllByA11yValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
24
|
+
findByA11yValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
25
|
+
findAllByA11yValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
26
|
+
getByAccessibilityValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
27
|
+
getAllByAccessibilityValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
28
|
+
queryByAccessibilityValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
29
|
+
queryAllByAccessibilityValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
30
|
+
findByAccessibilityValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
31
|
+
findAllByAccessibilityValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
32
|
+
getByA11yState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
33
|
+
getAllByA11yState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
34
|
+
queryByA11yState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
35
|
+
queryAllByA11yState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
36
|
+
findByA11yState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
37
|
+
findAllByA11yState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
38
|
+
getByAccessibilityState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
39
|
+
getAllByAccessibilityState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
40
|
+
queryByAccessibilityState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
41
|
+
queryAllByAccessibilityState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
42
|
+
findByAccessibilityState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
43
|
+
findAllByAccessibilityState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
44
|
+
getByRole: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher & {
|
|
45
45
|
name?: import("./matches").TextMatch | undefined;
|
|
46
|
-
value?: import("./helpers/matchers/
|
|
46
|
+
value?: import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher | undefined;
|
|
47
47
|
}>;
|
|
48
|
-
getAllByRole: import("./queries/
|
|
48
|
+
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher & {
|
|
49
49
|
name?: import("./matches").TextMatch | undefined;
|
|
50
|
-
value?: import("./helpers/matchers/
|
|
50
|
+
value?: import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher | undefined;
|
|
51
51
|
}>;
|
|
52
|
-
queryByRole: import("./queries/
|
|
52
|
+
queryByRole: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher & {
|
|
53
53
|
name?: import("./matches").TextMatch | undefined;
|
|
54
|
-
value?: import("./helpers/matchers/
|
|
54
|
+
value?: import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher | undefined;
|
|
55
55
|
}>;
|
|
56
|
-
queryAllByRole: import("./queries/
|
|
56
|
+
queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher & {
|
|
57
57
|
name?: import("./matches").TextMatch | undefined;
|
|
58
|
-
value?: import("./helpers/matchers/
|
|
58
|
+
value?: import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher | undefined;
|
|
59
59
|
}>;
|
|
60
|
-
findByRole: import("./queries/
|
|
60
|
+
findByRole: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher & {
|
|
61
61
|
name?: import("./matches").TextMatch | undefined;
|
|
62
|
-
value?: import("./helpers/matchers/
|
|
62
|
+
value?: import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher | undefined;
|
|
63
63
|
}>;
|
|
64
|
-
findAllByRole: import("./queries/
|
|
64
|
+
findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher & {
|
|
65
65
|
name?: import("./matches").TextMatch | undefined;
|
|
66
|
-
value?: import("./helpers/matchers/
|
|
66
|
+
value?: import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher | undefined;
|
|
67
67
|
}>;
|
|
68
|
-
getByHintText: import("./queries/
|
|
69
|
-
getAllByHintText: import("./queries/
|
|
70
|
-
queryByHintText: import("./queries/
|
|
71
|
-
queryAllByHintText: import("./queries/
|
|
72
|
-
findByHintText: import("./queries/
|
|
73
|
-
findAllByHintText: import("./queries/
|
|
74
|
-
getByA11yHint: import("./queries/
|
|
75
|
-
getAllByA11yHint: import("./queries/
|
|
76
|
-
queryByA11yHint: import("./queries/
|
|
77
|
-
queryAllByA11yHint: import("./queries/
|
|
78
|
-
findByA11yHint: import("./queries/
|
|
79
|
-
findAllByA11yHint: import("./queries/
|
|
80
|
-
getByAccessibilityHint: import("./queries/
|
|
81
|
-
getAllByAccessibilityHint: import("./queries/
|
|
82
|
-
queryByAccessibilityHint: import("./queries/
|
|
83
|
-
queryAllByAccessibilityHint: import("./queries/
|
|
84
|
-
findByAccessibilityHint: import("./queries/
|
|
85
|
-
findAllByAccessibilityHint: import("./queries/
|
|
86
|
-
getByLabelText: import("./queries/
|
|
87
|
-
getAllByLabelText: import("./queries/
|
|
88
|
-
queryByLabelText: import("./queries/
|
|
89
|
-
queryAllByLabelText: import("./queries/
|
|
90
|
-
findByLabelText: import("./queries/
|
|
91
|
-
findAllByLabelText: import("./queries/
|
|
92
|
-
getByPlaceholderText: import("./queries/
|
|
93
|
-
getAllByPlaceholderText: import("./queries/
|
|
94
|
-
queryByPlaceholderText: import("./queries/
|
|
95
|
-
queryAllByPlaceholderText: import("./queries/
|
|
96
|
-
findByPlaceholderText: import("./queries/
|
|
97
|
-
findAllByPlaceholderText: import("./queries/
|
|
98
|
-
getByDisplayValue: import("./queries/
|
|
99
|
-
getAllByDisplayValue: import("./queries/
|
|
100
|
-
queryByDisplayValue: import("./queries/
|
|
101
|
-
queryAllByDisplayValue: import("./queries/
|
|
102
|
-
findByDisplayValue: import("./queries/
|
|
103
|
-
findAllByDisplayValue: import("./queries/
|
|
104
|
-
getByTestId: import("./queries/
|
|
105
|
-
getAllByTestId: import("./queries/
|
|
106
|
-
queryByTestId: import("./queries/
|
|
107
|
-
queryAllByTestId: import("./queries/
|
|
108
|
-
findByTestId: import("./queries/
|
|
109
|
-
findAllByTestId: import("./queries/
|
|
110
|
-
getByText: import("./queries/
|
|
111
|
-
getAllByText: import("./queries/
|
|
112
|
-
queryByText: import("./queries/
|
|
113
|
-
queryAllByText: import("./queries/
|
|
114
|
-
findByText: import("./queries/
|
|
115
|
-
findAllByText: import("./queries/
|
|
68
|
+
getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
69
|
+
getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
70
|
+
queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
71
|
+
queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
72
|
+
findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
73
|
+
findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
74
|
+
getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
75
|
+
getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
76
|
+
queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
77
|
+
queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
78
|
+
findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
79
|
+
findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
80
|
+
getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
81
|
+
getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
82
|
+
queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
83
|
+
queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
84
|
+
findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
85
|
+
findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
86
|
+
getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
87
|
+
getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
88
|
+
queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
89
|
+
queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
90
|
+
findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
91
|
+
findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
92
|
+
getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
93
|
+
getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
94
|
+
queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
95
|
+
queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
96
|
+
findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
97
|
+
findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
98
|
+
getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
99
|
+
getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
100
|
+
queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
101
|
+
queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
102
|
+
findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
103
|
+
findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
104
|
+
getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
105
|
+
getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
106
|
+
queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
107
|
+
queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
108
|
+
findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
109
|
+
findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
110
|
+
getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
111
|
+
getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
112
|
+
queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
113
|
+
queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
114
|
+
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
115
|
+
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
116
116
|
};
|
|
117
117
|
export declare const getQueriesForElement: typeof within;
|
package/build/within.js
CHANGED
|
@@ -6,16 +6,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getQueriesForElement = void 0;
|
|
7
7
|
exports.within = within;
|
|
8
8
|
var _text = require("./queries/text");
|
|
9
|
-
var _testId = require("./queries/
|
|
10
|
-
var _displayValue = require("./queries/
|
|
11
|
-
var _placeholderText = require("./queries/
|
|
12
|
-
var _labelText = require("./queries/
|
|
13
|
-
var _hintText = require("./queries/
|
|
9
|
+
var _testId = require("./queries/test-id");
|
|
10
|
+
var _displayValue = require("./queries/display-value");
|
|
11
|
+
var _placeholderText = require("./queries/placeholder-text");
|
|
12
|
+
var _labelText = require("./queries/label-text");
|
|
13
|
+
var _hintText = require("./queries/hint-text");
|
|
14
14
|
var _role = require("./queries/role");
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var _unsafeType = require("./queries/
|
|
18
|
-
var _unsafeProps = require("./queries/
|
|
15
|
+
var _accessibilityState = require("./queries/accessibility-state");
|
|
16
|
+
var _accessibilityValue = require("./queries/accessibility-value");
|
|
17
|
+
var _unsafeType = require("./queries/unsafe-type");
|
|
18
|
+
var _unsafeProps = require("./queries/unsafe-props");
|
|
19
19
|
function within(instance) {
|
|
20
20
|
return {
|
|
21
21
|
...(0, _text.bindByTextQueries)(instance),
|
|
@@ -25,8 +25,8 @@ function within(instance) {
|
|
|
25
25
|
...(0, _labelText.bindByLabelTextQueries)(instance),
|
|
26
26
|
...(0, _hintText.bindByHintTextQueries)(instance),
|
|
27
27
|
...(0, _role.bindByRoleQueries)(instance),
|
|
28
|
-
...(0,
|
|
29
|
-
...(0,
|
|
28
|
+
...(0, _accessibilityState.bindByA11yStateQueries)(instance),
|
|
29
|
+
...(0, _accessibilityValue.bindByA11yValueQueries)(instance),
|
|
30
30
|
...(0, _unsafeType.bindUnsafeByTypeQueries)(instance),
|
|
31
31
|
...(0, _unsafeProps.bindUnsafeByPropsQueries)(instance)
|
|
32
32
|
};
|
package/build/within.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"within.js","names":["_text","require","_testId","_displayValue","_placeholderText","_labelText","_hintText","_role","
|
|
1
|
+
{"version":3,"file":"within.js","names":["_text","require","_testId","_displayValue","_placeholderText","_labelText","_hintText","_role","_accessibilityState","_accessibilityValue","_unsafeType","_unsafeProps","within","instance","bindByTextQueries","bindByTestIdQueries","bindByDisplayValueQueries","bindByPlaceholderTextQueries","bindByLabelTextQueries","bindByHintTextQueries","bindByRoleQueries","bindByA11yStateQueries","bindByA11yValueQueries","bindUnsafeByTypeQueries","bindUnsafeByPropsQueries","getQueriesForElement","exports"],"sources":["../src/within.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { bindByTextQueries } from './queries/text';\nimport { bindByTestIdQueries } from './queries/test-id';\nimport { bindByDisplayValueQueries } from './queries/display-value';\nimport { bindByPlaceholderTextQueries } from './queries/placeholder-text';\nimport { bindByLabelTextQueries } from './queries/label-text';\nimport { bindByHintTextQueries } from './queries/hint-text';\nimport { bindByRoleQueries } from './queries/role';\nimport { bindByA11yStateQueries } from './queries/accessibility-state';\nimport { bindByA11yValueQueries } from './queries/accessibility-value';\nimport { bindUnsafeByTypeQueries } from './queries/unsafe-type';\nimport { bindUnsafeByPropsQueries } from './queries/unsafe-props';\n\nexport function within(instance: ReactTestInstance) {\n return {\n ...bindByTextQueries(instance),\n ...bindByTestIdQueries(instance),\n ...bindByDisplayValueQueries(instance),\n ...bindByPlaceholderTextQueries(instance),\n ...bindByLabelTextQueries(instance),\n ...bindByHintTextQueries(instance),\n ...bindByRoleQueries(instance),\n ...bindByA11yStateQueries(instance),\n ...bindByA11yValueQueries(instance),\n ...bindUnsafeByTypeQueries(instance),\n ...bindUnsafeByPropsQueries(instance),\n };\n}\n\nexport const getQueriesForElement = within;\n"],"mappings":";;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA;AACA,IAAAO,mBAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AAEO,SAASW,MAAMA,CAACC,QAA2B,EAAE;EAClD,OAAO;IACL,GAAG,IAAAC,uBAAiB,EAACD,QAAQ,CAAC;IAC9B,GAAG,IAAAE,2BAAmB,EAACF,QAAQ,CAAC;IAChC,GAAG,IAAAG,uCAAyB,EAACH,QAAQ,CAAC;IACtC,GAAG,IAAAI,6CAA4B,EAACJ,QAAQ,CAAC;IACzC,GAAG,IAAAK,iCAAsB,EAACL,QAAQ,CAAC;IACnC,GAAG,IAAAM,+BAAqB,EAACN,QAAQ,CAAC;IAClC,GAAG,IAAAO,uBAAiB,EAACP,QAAQ,CAAC;IAC9B,GAAG,IAAAQ,0CAAsB,EAACR,QAAQ,CAAC;IACnC,GAAG,IAAAS,0CAAsB,EAACT,QAAQ,CAAC;IACnC,GAAG,IAAAU,mCAAuB,EAACV,QAAQ,CAAC;IACpC,GAAG,IAAAW,qCAAwB,EAACX,QAAQ;EACtC,CAAC;AACH;AAEO,MAAMY,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGb,MAAM"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/react-native",
|
|
3
|
-
"version": "12.3.
|
|
3
|
+
"version": "12.3.2",
|
|
4
4
|
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"jest-preset/",
|
|
30
30
|
"typings/index.flow.js",
|
|
31
31
|
"pure.js",
|
|
32
|
+
"pure.d.ts",
|
|
32
33
|
"dont-cleanup-after-each.js"
|
|
33
34
|
],
|
|
34
35
|
"devDependencies": {
|
package/pure.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './build/pure';
|