@testing-library/react-native 12.8.0 → 13.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/build/act.d.ts +2 -1
- package/build/act.js +14 -10
- package/build/act.js.map +1 -1
- package/build/config.d.ts +5 -5
- package/build/config.js +1 -1
- package/build/config.js.map +1 -1
- package/build/flush-micro-tasks.d.ts +0 -18
- package/build/flush-micro-tasks.js +0 -25
- package/build/flush-micro-tasks.js.map +1 -1
- package/build/helpers/{debug-deep.d.ts → debug.d.ts} +1 -1
- package/build/helpers/{debug-deep.js → debug.js} +3 -3
- package/build/helpers/debug.js.map +1 -0
- package/build/helpers/wrap-async.js +10 -27
- package/build/helpers/wrap-async.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.flow.js +4 -37
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/render.d.ts +5 -56
- package/build/render.js +5 -7
- package/build/render.js.map +1 -1
- package/build/screen.js +0 -25
- package/build/screen.js.map +1 -1
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/within.d.ts +0 -24
- package/build/within.js +0 -4
- package/build/within.js.map +1 -1
- package/matchers.d.ts +1 -0
- package/matchers.js +2 -0
- package/package.json +13 -9
- package/typings/index.flow.js +4 -37
- package/build/helpers/debug-deep.js.map +0 -1
- package/build/helpers/debug-shallow.d.ts +0 -6
- package/build/helpers/debug-shallow.js +0 -25
- package/build/helpers/debug-shallow.js.map +0 -1
- package/build/queries/accessibility-state.d.ts +0 -19
- package/build/queries/accessibility-state.js +0 -59
- package/build/queries/accessibility-state.js.map +0 -1
- package/build/queries/accessibility-value.d.ts +0 -19
- package/build/queries/accessibility-value.js +0 -59
- package/build/queries/accessibility-value.js.map +0 -1
- package/build/shallow.d.ts +0 -8
- package/build/shallow.js +0 -24
- package/build/shallow.js.map +0 -1
- package/extend-expect.d.ts +0 -1
- package/extend-expect.js +0 -1
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","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","render","component","options","renderInternal","wrapper","Wrapper","concurrentRoot","detectHostComponentNames","unstable_validateStringsRenderedWithinText","rest","testRendererOptions","unstable_isConcurrent","getConfig","configureHostComponentNamesIfNeeded","renderWithStringValidation","wrap","element","createElement","renderer","renderWithAct","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","toJSON","Profiler","id","onRender","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","rerender","debug","getHostChildren","UNSAFE_root","enumerable","Error","setRenderResult","debugImpl","defaultDebugOptions","debugOptions","message","console","warn","json","debugDeep","shallow","debugShallow"],"sources":["../src/render.tsx"],"sourcesContent":["import type {\n ReactTestInstance,\n ReactTestRenderer,\n TestRendererOptions,\n} 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 } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n wrapper?: React.ComponentType<any>;\n\n /**\n * Set to `true` to enable concurrent rendering.\n * Otherwise `render` will default to legacy synchronous rendering.\n */\n concurrentRoot?: boolean | undefined;\n\n createNodeMock?: (element: React.ReactElement) => unknown;\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>(component: React.ReactElement<T>, options: RenderOptions = {}) {\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 options?: RenderInternalOptions,\n) {\n const {\n wrapper: Wrapper,\n concurrentRoot,\n detectHostComponentNames = true,\n unstable_validateStringsRenderedWithinText,\n ...rest\n } = options || {};\n\n const testRendererOptions: TestRendererOptions = {\n ...rest,\n // @ts-expect-error incomplete typing on RTR package\n unstable_isConcurrent: concurrentRoot ?? getConfig().concurrentRoot,\n };\n\n if (detectHostComponentNames) {\n configureHostComponentNamesIfNeeded();\n }\n\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n ...testRendererOptions,\n });\n }\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n const renderer = renderWithAct(wrap(component), testRendererOptions);\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n options: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {},\n) {\n let renderer: ReactTestRenderer;\n const { wrapper: Wrapper, ...testRendererOptions } = options ?? {};\n\n const handleRender: React.ProfilerOnRenderCallback = (_, phase) => {\n if (renderer && phase === 'update') {\n validateStringsRenderedWithinText(renderer.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 renderer = renderWithAct(wrap(component), testRendererOptions);\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 void 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\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 void 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(instance: ReactTestInstance, renderer: ReactTestRenderer): 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":";;;;;;;AAKA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAA+B,I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AAE,GAAG4C,mBAAmB;MAAE,GAAG5C;IAAQ,CAAC;IAE5C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B;MACA+C,OAAO,CAACC,IAAI,CACV,+HACF,CAAC;IACH;IAEA,MAAMC,IAAI,GAAGjC,QAAQ,CAACO,MAAM,CAAC,CAAC;IAC9B,IAAI0B,IAAI,EAAE;MACR,OAAO,IAAAC,kBAAS,EAACD,IAAI,EAAEJ,YAAY,CAAC;IACtC;EACF;EACAF,SAAS,CAACQ,OAAO,GAAIL,OAAgB,IAAK,IAAAM,qBAAY,EAACvB,QAAQ,EAAEiB,OAAO,CAAC;EACzE,OAAOH,SAAS;AAClB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"render.js","names":["_react","_interopRequireWildcard","require","React","_act","_interopRequireDefault","_cleanup","_config","_componentTree","_debug","_hostComponentNames","_stringValidation","_renderAct","_screen","_within","e","__esModule","default","_getRequireWildcardCache","WeakMap","r","t","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","render","component","options","renderInternal","wrapper","Wrapper","concurrentRoot","detectHostComponentNames","unstable_validateStringsRenderedWithinText","rest","testRendererOptions","unstable_isConcurrent","getConfig","configureHostComponentNamesIfNeeded","renderWithStringValidation","wrap","element","createElement","renderer","renderWithAct","buildRenderResult","handleRender","_","phase","validateStringsRenderedWithinText","toJSON","Profiler","id","onRender","update","updateWithAct","instance","root","unmount","act","addToCleanupQueue","result","getQueriesForElement","rerender","debug","makeDebug","getHostChildren","UNSAFE_root","enumerable","Error","setRenderResult","debugImpl","defaultDebugOptions","debugOptions","message","console","warn","json"],"sources":["../src/render.tsx"],"sourcesContent":["import type {\n ReactTestInstance,\n ReactTestRenderer,\n TestRendererOptions,\n} 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 { debug, DebugOptions } from './helpers/debug';\nimport { configureHostComponentNamesIfNeeded } from './helpers/host-component-names';\nimport { validateStringsRenderedWithinText } from './helpers/string-validation';\nimport { renderWithAct } from './render-act';\nimport { setRenderResult } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n /**\n * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating\n * reusable custom render functions for common data providers.\n */\n wrapper?: React.ComponentType<any>;\n\n /**\n * Set to `false` to disable concurrent rendering.\n * Otherwise `render` will default to concurrent rendering.\n */\n concurrentRoot?: boolean;\n\n createNodeMock?: (element: React.ReactElement) => unknown;\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>(component: React.ReactElement<T>, options: RenderOptions = {}) {\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 options?: RenderInternalOptions,\n) {\n const {\n wrapper: Wrapper,\n concurrentRoot,\n detectHostComponentNames = true,\n unstable_validateStringsRenderedWithinText,\n ...rest\n } = options || {};\n\n const testRendererOptions: TestRendererOptions = {\n ...rest,\n // @ts-expect-error incomplete typing on RTR package\n unstable_isConcurrent: concurrentRoot ?? getConfig().concurrentRoot,\n };\n\n if (detectHostComponentNames) {\n configureHostComponentNamesIfNeeded();\n }\n\n if (unstable_validateStringsRenderedWithinText) {\n return renderWithStringValidation(component, {\n wrapper: Wrapper,\n ...testRendererOptions,\n });\n }\n\n const wrap = (element: React.ReactElement) => (Wrapper ? <Wrapper>{element}</Wrapper> : element);\n const renderer = renderWithAct(wrap(component), testRendererOptions);\n return buildRenderResult(renderer, wrap);\n}\n\nfunction renderWithStringValidation<T>(\n component: React.ReactElement<T>,\n options: Omit<RenderOptions, 'unstable_validateStringsRenderedWithinText'> = {},\n) {\n let renderer: ReactTestRenderer;\n const { wrapper: Wrapper, ...testRendererOptions } = options ?? {};\n\n const handleRender: React.ProfilerOnRenderCallback = (_, phase) => {\n if (renderer && phase === 'update') {\n validateStringsRenderedWithinText(renderer.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 renderer = renderWithAct(wrap(component), testRendererOptions);\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 void 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: makeDebug(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\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 void act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\nexport type DebugFunction = (options?: DebugOptions | string) => void;\n\nfunction makeDebug(instance: ReactTestInstance, renderer: ReactTestRenderer): 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 debug(json, debugOptions);\n }\n }\n return debugImpl;\n}\n"],"mappings":";;;;;;;AAKA,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,MAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAAgD,SAAAG,uBAAAU,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,yBAAAH,CAAA,6BAAAI,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAD,wBAAA,YAAAA,CAAAH,CAAA,WAAAA,CAAA,GAAAM,CAAA,GAAAD,CAAA,KAAAL,CAAA;AAAA,SAAAd,wBAAAc,CAAA,EAAAK,CAAA,SAAAA,CAAA,IAAAL,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAE,OAAA,EAAAF,CAAA,QAAAM,CAAA,GAAAH,wBAAA,CAAAE,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAC,GAAA,CAAAP,CAAA,UAAAM,CAAA,CAAAE,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B,SAASA,CAAC5C,OAA+B,EAAE;IAClD,MAAM;MAAE6C;IAAoB,CAAC,GAAG,IAAAnC,iBAAS,EAAC,CAAC;IAC3C,MAAMoC,YAAY,GAChB,OAAO9C,OAAO,KAAK,QAAQ,GACvB;MAAE,GAAG6C,mBAAmB;MAAEE,OAAO,EAAE/C;IAAQ,CAAC,GAC5C;MAAE,GAAG6C,mBAAmB;MAAE,GAAG7C;IAAQ,CAAC;IAE5C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B;MACAgD,OAAO,CAACC,IAAI,CACV,+HACF,CAAC;IACH;IAEA,MAAMC,IAAI,GAAGlC,QAAQ,CAACO,MAAM,CAAC,CAAC;IAC9B,IAAI2B,IAAI,EAAE;MACR,OAAO,IAAAb,YAAK,EAACa,IAAI,EAAEJ,YAAY,CAAC;IAClC;EACF;EACA,OAAOF,SAAS;AAClB","ignoreList":[]}
|
package/build/screen.js
CHANGED
|
@@ -13,7 +13,6 @@ const notImplemented = () => {
|
|
|
13
13
|
const notImplementedDebug = () => {
|
|
14
14
|
throw new Error(SCREEN_ERROR);
|
|
15
15
|
};
|
|
16
|
-
notImplementedDebug.shallow = notImplemented;
|
|
17
16
|
const defaultScreen = {
|
|
18
17
|
isDetached: true,
|
|
19
18
|
get root() {
|
|
@@ -57,30 +56,6 @@ const defaultScreen = {
|
|
|
57
56
|
queryAllByRole: notImplemented,
|
|
58
57
|
findByRole: notImplemented,
|
|
59
58
|
findAllByRole: notImplemented,
|
|
60
|
-
getByA11yState: notImplemented,
|
|
61
|
-
getAllByA11yState: notImplemented,
|
|
62
|
-
queryByA11yState: notImplemented,
|
|
63
|
-
queryAllByA11yState: notImplemented,
|
|
64
|
-
findByA11yState: notImplemented,
|
|
65
|
-
findAllByA11yState: notImplemented,
|
|
66
|
-
getByAccessibilityState: notImplemented,
|
|
67
|
-
getAllByAccessibilityState: notImplemented,
|
|
68
|
-
queryByAccessibilityState: notImplemented,
|
|
69
|
-
queryAllByAccessibilityState: notImplemented,
|
|
70
|
-
findByAccessibilityState: notImplemented,
|
|
71
|
-
findAllByAccessibilityState: notImplemented,
|
|
72
|
-
getByA11yValue: notImplemented,
|
|
73
|
-
getAllByA11yValue: notImplemented,
|
|
74
|
-
queryByA11yValue: notImplemented,
|
|
75
|
-
queryAllByA11yValue: notImplemented,
|
|
76
|
-
findByA11yValue: notImplemented,
|
|
77
|
-
findAllByA11yValue: notImplemented,
|
|
78
|
-
getByAccessibilityValue: notImplemented,
|
|
79
|
-
getAllByAccessibilityValue: notImplemented,
|
|
80
|
-
queryByAccessibilityValue: notImplemented,
|
|
81
|
-
queryAllByAccessibilityValue: notImplemented,
|
|
82
|
-
findByAccessibilityValue: notImplemented,
|
|
83
|
-
findAllByAccessibilityValue: notImplemented,
|
|
84
59
|
UNSAFE_getByProps: notImplemented,
|
|
85
60
|
UNSAFE_getAllByProps: notImplemented,
|
|
86
61
|
UNSAFE_queryByProps: notImplemented,
|
package/build/screen.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","
|
|
1
|
+
{"version":3,"file":"screen.js","names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","defaultScreen","isDetached","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","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","renderResult","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};\n\ninterface Screen extends RenderResult {\n isDetached?: boolean;\n}\n\nconst defaultScreen: Screen = {\n isDetached: true,\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 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: Screen = defaultScreen;\n\nexport function setRenderResult(renderResult: RenderResult) {\n screen = renderResult;\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;AAMD,MAAMI,aAAqB,GAAG;EAC5BC,UAAU,EAAE,IAAI;EAChB,IAAIC,IAAI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@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-act.ts","../src/render-hook.tsx","../src/render.tsx","../src/screen.ts","../src/
|
|
1
|
+
{"root":["../src/act.ts","../src/cleanup.ts","../src/config.ts","../src/fire-event.ts","../src/flush-micro-tasks.ts","../src/index.ts","../src/matches.ts","../src/native-state.ts","../src/pure.ts","../src/react-versions.ts","../src/render-act.ts","../src/render-hook.tsx","../src/render.tsx","../src/screen.ts","../src/types.ts","../src/wait-for-element-to-be-removed.ts","../src/wait-for.ts","../src/within.ts","../src/helpers/accessibility.ts","../src/helpers/component-tree.ts","../src/helpers/debug.ts","../src/helpers/deprecation.ts","../src/helpers/errors.ts","../src/helpers/find-all.ts","../src/helpers/format-default.ts","../src/helpers/format.ts","../src/helpers/host-component-names.tsx","../src/helpers/object.ts","../src/helpers/pointer-events.ts","../src/helpers/query-name.ts","../src/helpers/string-validation.ts","../src/helpers/text-content.ts","../src/helpers/text-input.ts","../src/helpers/timers.ts","../src/helpers/wrap-async.ts","../src/helpers/matchers/match-accessibility-state.ts","../src/helpers/matchers/match-accessibility-value.ts","../src/helpers/matchers/match-array-prop.ts","../src/helpers/matchers/match-label-text.ts","../src/helpers/matchers/match-object-prop.ts","../src/helpers/matchers/match-string-prop.ts","../src/helpers/matchers/match-text-content.ts","../src/matchers/extend-expect.ts","../src/matchers/index.ts","../src/matchers/to-be-busy.tsx","../src/matchers/to-be-checked.tsx","../src/matchers/to-be-disabled.tsx","../src/matchers/to-be-empty-element.tsx","../src/matchers/to-be-expanded.tsx","../src/matchers/to-be-on-the-screen.tsx","../src/matchers/to-be-partially-checked.tsx","../src/matchers/to-be-selected.ts","../src/matchers/to-be-visible.tsx","../src/matchers/to-contain-element.tsx","../src/matchers/to-have-accessibility-value.tsx","../src/matchers/to-have-accessible-name.tsx","../src/matchers/to-have-display-value.tsx","../src/matchers/to-have-prop.ts","../src/matchers/to-have-style.tsx","../src/matchers/to-have-text-content.tsx","../src/matchers/types.ts","../src/matchers/utils.tsx","../src/queries/display-value.ts","../src/queries/hint-text.ts","../src/queries/label-text.ts","../src/queries/make-queries.ts","../src/queries/options.ts","../src/queries/placeholder-text.ts","../src/queries/role.ts","../src/queries/test-id.ts","../src/queries/text.ts","../src/queries/unsafe-props.ts","../src/queries/unsafe-type.ts","../src/test-utils/events.ts","../src/test-utils/index.ts","../src/user-event/clear.ts","../src/user-event/index.ts","../src/user-event/paste.ts","../src/user-event/event-builder/base.ts","../src/user-event/event-builder/common.ts","../src/user-event/event-builder/index.ts","../src/user-event/event-builder/scroll-view.ts","../src/user-event/event-builder/text-input.ts","../src/user-event/press/constants.ts","../src/user-event/press/index.ts","../src/user-event/press/press.ts","../src/user-event/scroll/index.ts","../src/user-event/scroll/scroll-to.ts","../src/user-event/scroll/utils.ts","../src/user-event/setup/index.ts","../src/user-event/setup/setup.ts","../src/user-event/type/index.ts","../src/user-event/type/parse-keys.ts","../src/user-event/type/type.ts","../src/user-event/utils/content-size.ts","../src/user-event/utils/dispatch-event.ts","../src/user-event/utils/index.ts","../src/user-event/utils/text-range.ts","../src/user-event/utils/wait.ts"],"version":"5.6.3"}
|
package/build/within.d.ts
CHANGED
|
@@ -16,30 +16,6 @@ export declare function within(instance: ReactTestInstance): {
|
|
|
16
16
|
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
17
17
|
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
18
18
|
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
19
|
-
getByA11yValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
20
|
-
getAllByA11yValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
21
|
-
queryByA11yValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
22
|
-
queryAllByA11yValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
23
|
-
findByA11yValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
24
|
-
findAllByA11yValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
25
|
-
getByAccessibilityValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
26
|
-
getAllByAccessibilityValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
27
|
-
queryByAccessibilityValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
28
|
-
queryAllByAccessibilityValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
29
|
-
findByAccessibilityValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
30
|
-
findAllByAccessibilityValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
31
|
-
getByA11yState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
32
|
-
getAllByA11yState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
33
|
-
queryByA11yState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
34
|
-
queryAllByA11yState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
35
|
-
findByA11yState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
36
|
-
findAllByA11yState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
37
|
-
getByAccessibilityState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
38
|
-
getAllByAccessibilityState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
39
|
-
queryByAccessibilityState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
40
|
-
queryAllByAccessibilityState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
41
|
-
findByAccessibilityState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
42
|
-
findAllByAccessibilityState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
43
19
|
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
44
20
|
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
45
21
|
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
package/build/within.js
CHANGED
|
@@ -12,8 +12,6 @@ var _placeholderText = require("./queries/placeholder-text");
|
|
|
12
12
|
var _labelText = require("./queries/label-text");
|
|
13
13
|
var _hintText = require("./queries/hint-text");
|
|
14
14
|
var _role = require("./queries/role");
|
|
15
|
-
var _accessibilityState = require("./queries/accessibility-state");
|
|
16
|
-
var _accessibilityValue = require("./queries/accessibility-value");
|
|
17
15
|
var _unsafeType = require("./queries/unsafe-type");
|
|
18
16
|
var _unsafeProps = require("./queries/unsafe-props");
|
|
19
17
|
function within(instance) {
|
|
@@ -25,8 +23,6 @@ function within(instance) {
|
|
|
25
23
|
...(0, _labelText.bindByLabelTextQueries)(instance),
|
|
26
24
|
...(0, _hintText.bindByHintTextQueries)(instance),
|
|
27
25
|
...(0, _role.bindByRoleQueries)(instance),
|
|
28
|
-
...(0, _accessibilityState.bindByA11yStateQueries)(instance),
|
|
29
|
-
...(0, _accessibilityValue.bindByA11yValueQueries)(instance),
|
|
30
26
|
...(0, _unsafeType.bindUnsafeByTypeQueries)(instance),
|
|
31
27
|
...(0, _unsafeProps.bindUnsafeByPropsQueries)(instance)
|
|
32
28
|
};
|
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","_unsafeType","_unsafeProps","within","instance","bindByTextQueries","bindByTestIdQueries","bindByDisplayValueQueries","bindByPlaceholderTextQueries","bindByLabelTextQueries","bindByHintTextQueries","bindByRoleQueries","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 { 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 ...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,WAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AAEO,SAASS,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,mCAAuB,EAACR,QAAQ,CAAC;IACpC,GAAG,IAAAS,qCAAwB,EAACT,QAAQ;EACtC,CAAC;AACH;AAEO,MAAMU,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAGX,MAAM","ignoreList":[]}
|
package/matchers.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './build/matchers';
|
package/matchers.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0-alpha.0",
|
|
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",
|
|
@@ -34,13 +34,14 @@
|
|
|
34
34
|
"build:js": "babel src --out-dir build --extensions \".js,.ts,.jsx,.tsx\" --source-maps --ignore \"**/__tests__/**\"",
|
|
35
35
|
"build:ts": "tsc --build tsconfig.release.json",
|
|
36
36
|
"build": "yarn clean && yarn build:js && yarn build:ts && yarn copy-flowtypes",
|
|
37
|
-
"release": "release-it"
|
|
37
|
+
"release": "release-it",
|
|
38
|
+
"release:alpha": "release-it --preRelease=alpha"
|
|
38
39
|
},
|
|
39
40
|
"files": [
|
|
40
41
|
"build/",
|
|
41
42
|
"jest-preset/",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
43
|
+
"matchers.js",
|
|
44
|
+
"matchers.d.ts",
|
|
44
45
|
"pure.js",
|
|
45
46
|
"pure.d.ts",
|
|
46
47
|
"dont-cleanup-after-each.js",
|
|
@@ -52,10 +53,10 @@
|
|
|
52
53
|
"redent": "^3.0.0"
|
|
53
54
|
},
|
|
54
55
|
"peerDependencies": {
|
|
55
|
-
"jest": ">=
|
|
56
|
-
"react": ">=
|
|
57
|
-
"react-native": ">=0.
|
|
58
|
-
"react-test-renderer": ">=
|
|
56
|
+
"jest": ">=29.0.0",
|
|
57
|
+
"react": ">=18.2.0",
|
|
58
|
+
"react-native": ">=0.71",
|
|
59
|
+
"react-test-renderer": ">=18.2.0"
|
|
59
60
|
},
|
|
60
61
|
"peerDependenciesMeta": {
|
|
61
62
|
"jest": {
|
|
@@ -94,5 +95,8 @@
|
|
|
94
95
|
"publishConfig": {
|
|
95
96
|
"registry": "https://registry.npmjs.org"
|
|
96
97
|
},
|
|
97
|
-
"packageManager": "yarn@4.4.0"
|
|
98
|
+
"packageManager": "yarn@4.4.0",
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=18"
|
|
101
|
+
}
|
|
98
102
|
}
|
package/typings/index.flow.js
CHANGED
|
@@ -55,10 +55,10 @@ declare type A11yRole =
|
|
|
55
55
|
|
|
56
56
|
declare type A11yState = {|
|
|
57
57
|
disabled?: boolean,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
selected ?: boolean,
|
|
59
|
+
checked ?: boolean | 'mixed',
|
|
60
|
+
busy ?: boolean,
|
|
61
|
+
expanded ?: boolean,
|
|
62
62
|
|};
|
|
63
63
|
|
|
64
64
|
declare type A11yValue = {
|
|
@@ -258,38 +258,6 @@ interface A11yAPI {
|
|
|
258
258
|
queryOptions?: ByRoleOptions,
|
|
259
259
|
waitForOptions?: WaitForOptions
|
|
260
260
|
) => FindAllReturn;
|
|
261
|
-
|
|
262
|
-
// State
|
|
263
|
-
getByA11yState: (matcher: A11yState, options?: CommonQueryOptions) => GetReturn;
|
|
264
|
-
getAllByA11yState: (matcher: A11yState, options?: CommonQueryOptions) => GetAllReturn;
|
|
265
|
-
queryByA11yState: (matcher: A11yState, options?: CommonQueryOptions) => QueryReturn;
|
|
266
|
-
queryAllByA11yState: (matcher: A11yState, options?: CommonQueryOptions) => QueryAllReturn;
|
|
267
|
-
findByA11yState: (
|
|
268
|
-
matcher: A11yState,
|
|
269
|
-
queryOptions?: CommonQueryOptions,
|
|
270
|
-
waitForOptions?: WaitForOptions
|
|
271
|
-
) => FindReturn;
|
|
272
|
-
findAllByA11yState: (
|
|
273
|
-
matcher: A11yState,
|
|
274
|
-
queryOptions?: CommonQueryOptions,
|
|
275
|
-
waitForOptions?: WaitForOptions
|
|
276
|
-
) => FindAllReturn;
|
|
277
|
-
|
|
278
|
-
// Value
|
|
279
|
-
getByA11yValue: (matcher: A11yValue, options?: CommonQueryOptions) => GetReturn;
|
|
280
|
-
getAllByA11yValue: (matcher: A11yValue, options?: CommonQueryOptions) => GetAllReturn;
|
|
281
|
-
queryByA11yValue: (matcher: A11yValue, options?: CommonQueryOptions) => QueryReturn;
|
|
282
|
-
queryAllByA11yValue: (matcher: A11yValue, options?: CommonQueryOptions) => QueryAllReturn;
|
|
283
|
-
findByA11yValue: (
|
|
284
|
-
matcher: A11yValue,
|
|
285
|
-
queryOptions?: CommonQueryOptions,
|
|
286
|
-
waitForOptions?: WaitForOptions
|
|
287
|
-
) => FindReturn;
|
|
288
|
-
findAllByA11yValue: (
|
|
289
|
-
matcher: A11yValue,
|
|
290
|
-
queryOptions?: CommonQueryOptions,
|
|
291
|
-
waitForOptions?: WaitForOptions
|
|
292
|
-
) => FindAllReturn;
|
|
293
261
|
}
|
|
294
262
|
|
|
295
263
|
interface Thenable {
|
|
@@ -308,7 +276,6 @@ type DebugOptions = {
|
|
|
308
276
|
|
|
309
277
|
type Debug = {
|
|
310
278
|
(options?: DebugOptions | string): void,
|
|
311
|
-
shallow: (message?: string) => void,
|
|
312
279
|
};
|
|
313
280
|
|
|
314
281
|
type Queries = ByTextQueries &
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-deep.js","names":["_format","_interopRequireDefault","require","e","__esModule","default","debugDeep","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debug-deep.ts"],"sourcesContent":["import type { ReactTestRendererJSON } from 'react-test-renderer';\nimport format, { FormatOptions } from './format';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport default function debugDeep(\n instance: ReactTestRendererJSON | ReactTestRendererJSON[],\n options?: DebugOptions | string,\n) {\n const message = typeof options === 'string' ? options : options?.message;\n\n const formatOptions = typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(instance, formatOptions));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMjD;AACA;AACA;AACe,SAASG,SAASA,CAC/BC,QAAyD,EACzDC,OAA+B,EAC/B;EACA,MAAMC,OAAO,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,EAAEC,OAAO;EAExE,MAAMC,aAAa,GAAG,OAAOF,OAAO,KAAK,QAAQ,GAAG;IAAEG,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC,GAAGC,SAAS;EAE/F,IAAIH,OAAO,EAAE;IACX;IACAI,OAAO,CAACC,GAAG,CAAC,GAAGL,OAAO,MAAM,EAAE,IAAAM,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACL;IACAG,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAC9C;AACF","ignoreList":[]}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { ReactTestInstance } from 'react-test-renderer';
|
|
3
|
-
/**
|
|
4
|
-
* Log pretty-printed shallow test component instance
|
|
5
|
-
*/
|
|
6
|
-
export default function debugShallow(instance: ReactTestInstance | React.ReactElement<any>, message?: string): void;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = debugShallow;
|
|
7
|
-
var _shallow = require("../shallow");
|
|
8
|
-
var _format = _interopRequireDefault(require("./format"));
|
|
9
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
-
/**
|
|
11
|
-
* Log pretty-printed shallow test component instance
|
|
12
|
-
*/
|
|
13
|
-
function debugShallow(instance, message) {
|
|
14
|
-
const {
|
|
15
|
-
output
|
|
16
|
-
} = (0, _shallow.shallowInternal)(instance);
|
|
17
|
-
if (message) {
|
|
18
|
-
// eslint-disable-next-line no-console
|
|
19
|
-
console.log(`${message}\n\n`, (0, _format.default)(output));
|
|
20
|
-
} else {
|
|
21
|
-
// eslint-disable-next-line no-console
|
|
22
|
-
console.log((0, _format.default)(output));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=debug-shallow.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"debug-shallow.js","names":["_shallow","require","_format","_interopRequireDefault","e","__esModule","default","debugShallow","instance","message","output","shallowInternal","console","log","format"],"sources":["../../src/helpers/debug-shallow.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport { shallowInternal } from '../shallow';\nimport format from './format';\n\n/**\n * Log pretty-printed shallow test component instance\n */\nexport default function debugShallow(\n instance: ReactTestInstance | React.ReactElement<any>,\n message?: string,\n) {\n const { output } = shallowInternal(instance);\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(output));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(output));\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA8B,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE9B;AACA;AACA;AACe,SAASG,YAAYA,CAClCC,QAAqD,EACrDC,OAAgB,EAChB;EACA,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,wBAAe,EAACH,QAAQ,CAAC;EAE5C,IAAIC,OAAO,EAAE;IACX;IACAG,OAAO,CAACC,GAAG,CAAC,GAAGJ,OAAO,MAAM,EAAE,IAAAK,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC/C,CAAC,MAAM;IACL;IACAE,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACJ,MAAM,CAAC,CAAC;EAC7B;AACF","ignoreList":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactTestInstance } from 'react-test-renderer';
|
|
2
|
-
import { AccessibilityStateMatcher } from '../helpers/matchers/match-accessibility-state';
|
|
3
|
-
import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
|
|
4
|
-
import { CommonQueryOptions } from './options';
|
|
5
|
-
export type ByA11yStateQueries = {
|
|
6
|
-
getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
7
|
-
getAllByA11yState: GetAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
8
|
-
queryByA11yState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
9
|
-
queryAllByA11yState: QueryAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
10
|
-
findByA11yState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
11
|
-
findAllByA11yState: FindAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
12
|
-
getByAccessibilityState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
13
|
-
getAllByAccessibilityState: GetAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
14
|
-
queryByAccessibilityState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
15
|
-
queryAllByAccessibilityState: QueryAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
16
|
-
findByAccessibilityState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
17
|
-
findAllByAccessibilityState: FindAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;
|
|
18
|
-
};
|
|
19
|
-
export declare const bindByA11yStateQueries: (instance: ReactTestInstance) => ByA11yStateQueries;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.bindByA11yStateQueries = void 0;
|
|
7
|
-
var _accessibility = require("../helpers/accessibility");
|
|
8
|
-
var _deprecation = require("../helpers/deprecation");
|
|
9
|
-
var _findAll = require("../helpers/find-all");
|
|
10
|
-
var _matchAccessibilityState = require("../helpers/matchers/match-accessibility-state");
|
|
11
|
-
var _makeQueries = require("./make-queries");
|
|
12
|
-
const queryAllByA11yState = instance => function queryAllByA11yStateFn(matcher, queryOptions) {
|
|
13
|
-
return (0, _findAll.findAll)(instance, node => (0, _matchAccessibilityState.matchAccessibilityState)(node, matcher), queryOptions);
|
|
14
|
-
};
|
|
15
|
-
const buildErrorMessage = (state = {}) => {
|
|
16
|
-
const errors = [];
|
|
17
|
-
_accessibility.accessibilityStateKeys.forEach(stateKey => {
|
|
18
|
-
if (state[stateKey] !== undefined) {
|
|
19
|
-
errors.push(`${stateKey} state: ${state[stateKey]}`);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return errors.join(', ');
|
|
23
|
-
};
|
|
24
|
-
const getMultipleError = state => `Found multiple elements with ${buildErrorMessage(state)}`;
|
|
25
|
-
const getMissingError = state => `Unable to find an element with ${buildErrorMessage(state)}`;
|
|
26
|
-
const {
|
|
27
|
-
getBy,
|
|
28
|
-
getAllBy,
|
|
29
|
-
queryBy,
|
|
30
|
-
queryAllBy,
|
|
31
|
-
findBy,
|
|
32
|
-
findAllBy
|
|
33
|
-
} = (0, _makeQueries.makeQueries)(queryAllByA11yState, getMissingError, getMultipleError);
|
|
34
|
-
const bindByA11yStateQueries = instance => {
|
|
35
|
-
const getByA11yState = getBy(instance);
|
|
36
|
-
const getAllByA11yState = getAllBy(instance);
|
|
37
|
-
const queryByA11yState = queryBy(instance);
|
|
38
|
-
const queryAllByA11yState = queryAllBy(instance);
|
|
39
|
-
const findByA11yState = findBy(instance);
|
|
40
|
-
const findAllByA11yState = findAllBy(instance);
|
|
41
|
-
return {
|
|
42
|
-
...(0, _deprecation.deprecateQueries)({
|
|
43
|
-
getByA11yState,
|
|
44
|
-
getAllByA11yState,
|
|
45
|
-
queryByA11yState,
|
|
46
|
-
queryAllByA11yState,
|
|
47
|
-
findByA11yState,
|
|
48
|
-
findAllByA11yState,
|
|
49
|
-
getByAccessibilityState: getByA11yState,
|
|
50
|
-
getAllByAccessibilityState: getAllByA11yState,
|
|
51
|
-
queryByAccessibilityState: queryByA11yState,
|
|
52
|
-
queryAllByAccessibilityState: queryAllByA11yState,
|
|
53
|
-
findByAccessibilityState: findByA11yState,
|
|
54
|
-
findAllByAccessibilityState: findAllByA11yState
|
|
55
|
-
}, 'Use {queryPrefix}ByRole(role, { disabled, selected, checked, busy, expanded }) query or built-in Jest matchers: toBeDisabled(), toBeSelected(), toBeChecked(), toBeBusy(), and toBeExpanded() instead.')
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
exports.bindByA11yStateQueries = bindByA11yStateQueries;
|
|
59
|
-
//# sourceMappingURL=accessibility-state.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"accessibility-state.js","names":["_accessibility","require","_deprecation","_findAll","_matchAccessibilityState","_makeQueries","queryAllByA11yState","instance","queryAllByA11yStateFn","matcher","queryOptions","findAll","node","matchAccessibilityState","buildErrorMessage","state","errors","accessibilityStateKeys","forEach","stateKey","undefined","push","join","getMultipleError","getMissingError","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy","makeQueries","bindByA11yStateQueries","getByA11yState","getAllByA11yState","queryByA11yState","findByA11yState","findAllByA11yState","deprecateQueries","getByAccessibilityState","getAllByAccessibilityState","queryByAccessibilityState","queryAllByAccessibilityState","findByAccessibilityState","findAllByAccessibilityState","exports"],"sources":["../../src/queries/accessibility-state.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { accessibilityStateKeys } from '../helpers/accessibility';\nimport { deprecateQueries } from '../helpers/deprecation';\nimport { findAll } from '../helpers/find-all';\nimport {\n AccessibilityStateMatcher,\n matchAccessibilityState,\n} from '../helpers/matchers/match-accessibility-state';\nimport { makeQueries } from './make-queries';\nimport type {\n FindAllByQuery,\n FindByQuery,\n GetAllByQuery,\n GetByQuery,\n QueryAllByQuery,\n QueryByQuery,\n} from './make-queries';\nimport { CommonQueryOptions } from './options';\n\nconst queryAllByA11yState = (\n instance: ReactTestInstance,\n): QueryAllByQuery<AccessibilityStateMatcher, CommonQueryOptions> =>\n function queryAllByA11yStateFn(matcher, queryOptions) {\n return findAll(instance, (node) => matchAccessibilityState(node, matcher), queryOptions);\n };\n\nconst buildErrorMessage = (state: AccessibilityStateMatcher = {}) => {\n const errors: string[] = [];\n\n accessibilityStateKeys.forEach((stateKey) => {\n if (state[stateKey] !== undefined) {\n errors.push(`${stateKey} state: ${state[stateKey]}`);\n }\n });\n\n return errors.join(', ');\n};\n\nconst getMultipleError = (state: AccessibilityStateMatcher) =>\n `Found multiple elements with ${buildErrorMessage(state)}`;\n\nconst getMissingError = (state: AccessibilityStateMatcher) =>\n `Unable to find an element with ${buildErrorMessage(state)}`;\n\nconst { getBy, getAllBy, queryBy, queryAllBy, findBy, findAllBy } = makeQueries(\n queryAllByA11yState,\n getMissingError,\n getMultipleError,\n);\n\nexport type ByA11yStateQueries = {\n getByA11yState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n getAllByA11yState: GetAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryByA11yState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryAllByA11yState: QueryAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findByA11yState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findAllByA11yState: FindAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n\n getByAccessibilityState: GetByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n getAllByAccessibilityState: GetAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryByAccessibilityState: QueryByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n queryAllByAccessibilityState: QueryAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findByAccessibilityState: FindByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n findAllByAccessibilityState: FindAllByQuery<AccessibilityStateMatcher, CommonQueryOptions>;\n};\n\nexport const bindByA11yStateQueries = (instance: ReactTestInstance): ByA11yStateQueries => {\n const getByA11yState = getBy(instance);\n const getAllByA11yState = getAllBy(instance);\n const queryByA11yState = queryBy(instance);\n const queryAllByA11yState = queryAllBy(instance);\n const findByA11yState = findBy(instance);\n const findAllByA11yState = findAllBy(instance);\n\n return {\n ...deprecateQueries(\n {\n getByA11yState,\n getAllByA11yState,\n queryByA11yState,\n queryAllByA11yState,\n findByA11yState,\n findAllByA11yState,\n getByAccessibilityState: getByA11yState,\n getAllByAccessibilityState: getAllByA11yState,\n queryByAccessibilityState: queryByA11yState,\n queryAllByAccessibilityState: queryAllByA11yState,\n findByAccessibilityState: findByA11yState,\n findAllByAccessibilityState: findAllByA11yState,\n },\n 'Use {queryPrefix}ByRole(role, { disabled, selected, checked, busy, expanded }) query or built-in Jest matchers: toBeDisabled(), toBeSelected(), toBeChecked(), toBeBusy(), and toBeExpanded() instead.',\n ),\n };\n};\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,wBAAA,GAAAH,OAAA;AAIA,IAAAI,YAAA,GAAAJ,OAAA;AAWA,MAAMK,mBAAmB,GACvBC,QAA2B,IAE3B,SAASC,qBAAqBA,CAACC,OAAO,EAAEC,YAAY,EAAE;EACpD,OAAO,IAAAC,gBAAO,EAACJ,QAAQ,EAAGK,IAAI,IAAK,IAAAC,gDAAuB,EAACD,IAAI,EAAEH,OAAO,CAAC,EAAEC,YAAY,CAAC;AAC1F,CAAC;AAEH,MAAMI,iBAAiB,GAAGA,CAACC,KAAgC,GAAG,CAAC,CAAC,KAAK;EACnE,MAAMC,MAAgB,GAAG,EAAE;EAE3BC,qCAAsB,CAACC,OAAO,CAAEC,QAAQ,IAAK;IAC3C,IAAIJ,KAAK,CAACI,QAAQ,CAAC,KAAKC,SAAS,EAAE;MACjCJ,MAAM,CAACK,IAAI,CAAC,GAAGF,QAAQ,WAAWJ,KAAK,CAACI,QAAQ,CAAC,EAAE,CAAC;IACtD;EACF,CAAC,CAAC;EAEF,OAAOH,MAAM,CAACM,IAAI,CAAC,IAAI,CAAC;AAC1B,CAAC;AAED,MAAMC,gBAAgB,GAAIR,KAAgC,IACxD,gCAAgCD,iBAAiB,CAACC,KAAK,CAAC,EAAE;AAE5D,MAAMS,eAAe,GAAIT,KAAgC,IACvD,kCAAkCD,iBAAiB,CAACC,KAAK,CAAC,EAAE;AAE9D,MAAM;EAAEU,KAAK;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,UAAU;EAAEC,MAAM;EAAEC;AAAU,CAAC,GAAG,IAAAC,wBAAW,EAC7EzB,mBAAmB,EACnBkB,eAAe,EACfD,gBACF,CAAC;AAkBM,MAAMS,sBAAsB,GAAIzB,QAA2B,IAAyB;EACzF,MAAM0B,cAAc,GAAGR,KAAK,CAAClB,QAAQ,CAAC;EACtC,MAAM2B,iBAAiB,GAAGR,QAAQ,CAACnB,QAAQ,CAAC;EAC5C,MAAM4B,gBAAgB,GAAGR,OAAO,CAACpB,QAAQ,CAAC;EAC1C,MAAMD,mBAAmB,GAAGsB,UAAU,CAACrB,QAAQ,CAAC;EAChD,MAAM6B,eAAe,GAAGP,MAAM,CAACtB,QAAQ,CAAC;EACxC,MAAM8B,kBAAkB,GAAGP,SAAS,CAACvB,QAAQ,CAAC;EAE9C,OAAO;IACL,GAAG,IAAA+B,6BAAgB,EACjB;MACEL,cAAc;MACdC,iBAAiB;MACjBC,gBAAgB;MAChB7B,mBAAmB;MACnB8B,eAAe;MACfC,kBAAkB;MAClBE,uBAAuB,EAAEN,cAAc;MACvCO,0BAA0B,EAAEN,iBAAiB;MAC7CO,yBAAyB,EAAEN,gBAAgB;MAC3CO,4BAA4B,EAAEpC,mBAAmB;MACjDqC,wBAAwB,EAAEP,eAAe;MACzCQ,2BAA2B,EAAEP;IAC/B,CAAC,EACD,wMACF;EACF,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAb,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactTestInstance } from 'react-test-renderer';
|
|
2
|
-
import { AccessibilityValueMatcher } from '../helpers/matchers/match-accessibility-value';
|
|
3
|
-
import type { FindAllByQuery, FindByQuery, GetAllByQuery, GetByQuery, QueryAllByQuery, QueryByQuery } from './make-queries';
|
|
4
|
-
import { CommonQueryOptions } from './options';
|
|
5
|
-
export type ByA11yValueQueries = {
|
|
6
|
-
getByA11yValue: GetByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
7
|
-
getAllByA11yValue: GetAllByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
8
|
-
queryByA11yValue: QueryByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
9
|
-
queryAllByA11yValue: QueryAllByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
10
|
-
findByA11yValue: FindByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
11
|
-
findAllByA11yValue: FindAllByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
12
|
-
getByAccessibilityValue: GetByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
13
|
-
getAllByAccessibilityValue: GetAllByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
14
|
-
queryByAccessibilityValue: QueryByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
15
|
-
queryAllByAccessibilityValue: QueryAllByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
16
|
-
findByAccessibilityValue: FindByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
17
|
-
findAllByAccessibilityValue: FindAllByQuery<AccessibilityValueMatcher, CommonQueryOptions>;
|
|
18
|
-
};
|
|
19
|
-
export declare const bindByA11yValueQueries: (instance: ReactTestInstance) => ByA11yValueQueries;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.bindByA11yValueQueries = void 0;
|
|
7
|
-
var _accessibility = require("../helpers/accessibility");
|
|
8
|
-
var _deprecation = require("../helpers/deprecation");
|
|
9
|
-
var _findAll = require("../helpers/find-all");
|
|
10
|
-
var _matchAccessibilityValue = require("../helpers/matchers/match-accessibility-value");
|
|
11
|
-
var _makeQueries = require("./make-queries");
|
|
12
|
-
const queryAllByA11yValue = instance => function queryAllByA11yValueFn(value, queryOptions) {
|
|
13
|
-
return (0, _findAll.findAll)(instance, node => (0, _matchAccessibilityValue.matchAccessibilityValue)(node, value), queryOptions);
|
|
14
|
-
};
|
|
15
|
-
const formatQueryParams = matcher => {
|
|
16
|
-
const params = [];
|
|
17
|
-
_accessibility.accessibilityValueKeys.forEach(valueKey => {
|
|
18
|
-
if (matcher[valueKey] !== undefined) {
|
|
19
|
-
params.push(`${valueKey} value: ${matcher[valueKey]}`);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return params.join(', ');
|
|
23
|
-
};
|
|
24
|
-
const getMultipleError = matcher => `Found multiple elements with ${formatQueryParams(matcher)}`;
|
|
25
|
-
const getMissingError = matcher => `Unable to find an element with ${formatQueryParams(matcher)}`;
|
|
26
|
-
const {
|
|
27
|
-
getBy,
|
|
28
|
-
getAllBy,
|
|
29
|
-
queryBy,
|
|
30
|
-
queryAllBy,
|
|
31
|
-
findBy,
|
|
32
|
-
findAllBy
|
|
33
|
-
} = (0, _makeQueries.makeQueries)(queryAllByA11yValue, getMissingError, getMultipleError);
|
|
34
|
-
const bindByA11yValueQueries = instance => {
|
|
35
|
-
const getByA11yValue = getBy(instance);
|
|
36
|
-
const getAllByA11yValue = getAllBy(instance);
|
|
37
|
-
const queryByA11yValue = queryBy(instance);
|
|
38
|
-
const queryAllByA11yValue = queryAllBy(instance);
|
|
39
|
-
const findByA11yValue = findBy(instance);
|
|
40
|
-
const findAllByA11yValue = findAllBy(instance);
|
|
41
|
-
return {
|
|
42
|
-
...(0, _deprecation.deprecateQueries)({
|
|
43
|
-
getByA11yValue,
|
|
44
|
-
getAllByA11yValue,
|
|
45
|
-
queryByA11yValue,
|
|
46
|
-
queryAllByA11yValue,
|
|
47
|
-
findByA11yValue,
|
|
48
|
-
findAllByA11yValue,
|
|
49
|
-
getByAccessibilityValue: getByA11yValue,
|
|
50
|
-
getAllByAccessibilityValue: getAllByA11yValue,
|
|
51
|
-
queryByAccessibilityValue: queryByA11yValue,
|
|
52
|
-
queryAllByAccessibilityValue: queryAllByA11yValue,
|
|
53
|
-
findByAccessibilityValue: findByA11yValue,
|
|
54
|
-
findAllByAccessibilityValue: findAllByA11yValue
|
|
55
|
-
}, 'Use toHaveAccessibilityValue(...) built-in Jest matcher or {queryPrefix}ByRole(role, { value: ... }) query instead.')
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
exports.bindByA11yValueQueries = bindByA11yValueQueries;
|
|
59
|
-
//# sourceMappingURL=accessibility-value.js.map
|