@testing-library/react-native 12.7.2 → 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 +2 -7
- 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 +11 -1
- package/build/config.js +2 -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/host-component-names.js +1 -1
- package/build/helpers/host-component-names.js.map +1 -1
- 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-hook.js +1 -1
- package/build/render-hook.js.map +1 -1
- package/build/render.d.ts +11 -53
- package/build/render.js +12 -8
- 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 -0
- package/build/within.d.ts +4 -28
- 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 +29 -24
- 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.d.ts
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { ReactTestInstance } from 'react-test-renderer';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { DebugOptions } from './helpers/debug
|
|
3
|
+
import { DebugOptions } from './helpers/debug';
|
|
4
4
|
export interface RenderOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
|
|
7
|
+
* reusable custom render functions for common data providers.
|
|
8
|
+
*/
|
|
5
9
|
wrapper?: React.ComponentType<any>;
|
|
10
|
+
/**
|
|
11
|
+
* Set to `false` to disable concurrent rendering.
|
|
12
|
+
* Otherwise `render` will default to concurrent rendering.
|
|
13
|
+
*/
|
|
14
|
+
concurrentRoot?: boolean;
|
|
6
15
|
createNodeMock?: (element: React.ReactElement) => unknown;
|
|
7
16
|
unstable_validateStringsRenderedWithinText?: boolean;
|
|
8
17
|
}
|
|
@@ -35,30 +44,6 @@ export default function render<T>(component: React.ReactElement<T>, options?: Re
|
|
|
35
44
|
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
36
45
|
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
37
46
|
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
38
|
-
getByA11yValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
39
|
-
getAllByA11yValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
40
|
-
queryByA11yValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
41
|
-
queryAllByA11yValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
42
|
-
findByA11yValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
43
|
-
findAllByA11yValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
44
|
-
getByAccessibilityValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
45
|
-
getAllByAccessibilityValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
46
|
-
queryByAccessibilityValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
47
|
-
queryAllByAccessibilityValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
48
|
-
findByAccessibilityValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
49
|
-
findAllByAccessibilityValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
50
|
-
getByA11yState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
51
|
-
getAllByA11yState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
52
|
-
queryByA11yState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
53
|
-
queryAllByA11yState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
54
|
-
findByA11yState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
55
|
-
findAllByA11yState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
56
|
-
getByAccessibilityState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
57
|
-
getAllByAccessibilityState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
58
|
-
queryByAccessibilityState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
59
|
-
queryAllByAccessibilityState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
60
|
-
findByAccessibilityState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
61
|
-
findAllByAccessibilityState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
62
47
|
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
63
48
|
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
64
49
|
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
@@ -141,30 +126,6 @@ export declare function renderInternal<T>(component: React.ReactElement<T>, opti
|
|
|
141
126
|
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
142
127
|
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
143
128
|
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
144
|
-
getByA11yValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
145
|
-
getAllByA11yValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
146
|
-
queryByA11yValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
147
|
-
queryAllByA11yValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
148
|
-
findByA11yValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
149
|
-
findAllByA11yValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
150
|
-
getByAccessibilityValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
151
|
-
getAllByAccessibilityValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
152
|
-
queryByAccessibilityValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
153
|
-
queryAllByAccessibilityValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
154
|
-
findByAccessibilityValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
155
|
-
findAllByAccessibilityValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
156
|
-
getByA11yState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
157
|
-
getAllByA11yState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
158
|
-
queryByA11yState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
159
|
-
queryAllByA11yState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
160
|
-
findByA11yState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
161
|
-
findAllByA11yState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
162
|
-
getByAccessibilityState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
163
|
-
getAllByAccessibilityState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
164
|
-
queryByAccessibilityState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
165
|
-
queryAllByAccessibilityState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
166
|
-
findByAccessibilityState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
167
|
-
findAllByAccessibilityState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
168
129
|
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
169
130
|
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
170
131
|
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
@@ -220,7 +181,4 @@ export declare function renderInternal<T>(component: React.ReactElement<T>, opti
|
|
|
220
181
|
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
221
182
|
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
222
183
|
};
|
|
223
|
-
export
|
|
224
|
-
(options?: DebugOptions | string): void;
|
|
225
|
-
shallow: (message?: string) => void;
|
|
226
|
-
}
|
|
184
|
+
export type DebugFunction = (options?: DebugOptions | string) => void;
|
package/build/render.js
CHANGED
|
@@ -11,8 +11,7 @@ var _act = _interopRequireDefault(require("./act"));
|
|
|
11
11
|
var _cleanup = require("./cleanup");
|
|
12
12
|
var _config = require("./config");
|
|
13
13
|
var _componentTree = require("./helpers/component-tree");
|
|
14
|
-
var
|
|
15
|
-
var _debugShallow = _interopRequireDefault(require("./helpers/debug-shallow"));
|
|
14
|
+
var _debug = require("./helpers/debug");
|
|
16
15
|
var _hostComponentNames = require("./helpers/host-component-names");
|
|
17
16
|
var _stringValidation = require("./helpers/string-validation");
|
|
18
17
|
var _renderAct = require("./render-act");
|
|
@@ -31,10 +30,16 @@ function render(component, options = {}) {
|
|
|
31
30
|
function renderInternal(component, options) {
|
|
32
31
|
const {
|
|
33
32
|
wrapper: Wrapper,
|
|
33
|
+
concurrentRoot,
|
|
34
34
|
detectHostComponentNames = true,
|
|
35
35
|
unstable_validateStringsRenderedWithinText,
|
|
36
|
-
...
|
|
36
|
+
...rest
|
|
37
37
|
} = options || {};
|
|
38
|
+
const testRendererOptions = {
|
|
39
|
+
...rest,
|
|
40
|
+
// @ts-expect-error incomplete typing on RTR package
|
|
41
|
+
unstable_isConcurrent: concurrentRoot ?? (0, _config.getConfig)().concurrentRoot
|
|
42
|
+
};
|
|
38
43
|
if (detectHostComponentNames) {
|
|
39
44
|
(0, _hostComponentNames.configureHostComponentNamesIfNeeded)();
|
|
40
45
|
}
|
|
@@ -83,7 +88,7 @@ function buildRenderResult(renderer, wrap) {
|
|
|
83
88
|
rerender: update,
|
|
84
89
|
// alias for `update`
|
|
85
90
|
toJSON: renderer.toJSON,
|
|
86
|
-
debug:
|
|
91
|
+
debug: makeDebug(instance, renderer),
|
|
87
92
|
get root() {
|
|
88
93
|
return (0, _componentTree.getHostChildren)(instance)[0];
|
|
89
94
|
},
|
|
@@ -108,7 +113,7 @@ function updateWithAct(renderer, wrap) {
|
|
|
108
113
|
});
|
|
109
114
|
};
|
|
110
115
|
}
|
|
111
|
-
function
|
|
116
|
+
function makeDebug(instance, renderer) {
|
|
112
117
|
function debugImpl(options) {
|
|
113
118
|
const {
|
|
114
119
|
defaultDebugOptions
|
|
@@ -122,14 +127,13 @@ function debug(instance, renderer) {
|
|
|
122
127
|
};
|
|
123
128
|
if (typeof options === 'string') {
|
|
124
129
|
// eslint-disable-next-line no-console
|
|
125
|
-
console.warn('Using debug("message") is deprecated and will be removed in future release, please use debug({ message
|
|
130
|
+
console.warn('Using debug("message") is deprecated and will be removed in future release, please use debug({ message: "message" }) instead.');
|
|
126
131
|
}
|
|
127
132
|
const json = renderer.toJSON();
|
|
128
133
|
if (json) {
|
|
129
|
-
return (0,
|
|
134
|
+
return (0, _debug.debug)(json, debugOptions);
|
|
130
135
|
}
|
|
131
136
|
}
|
|
132
|
-
debugImpl.shallow = message => (0, _debugShallow.default)(instance, message);
|
|
133
137
|
return debugImpl;
|
|
134
138
|
}
|
|
135
139
|
//# sourceMappingURL=render.js.map
|
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","detectHostComponentNames","unstable_validateStringsRenderedWithinText","testRendererOptions","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","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 } from './screen';\nimport { getQueriesForElement } from './within';\n\nexport interface RenderOptions {\n wrapper?: React.ComponentType<any>;\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 detectHostComponentNames = true,\n unstable_validateStringsRenderedWithinText,\n ...testRendererOptions\n } = options || {};\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":";;;;;;;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,GAAAZ,OAAA;AACA,IAAAa,OAAA,GAAAb,OAAA;AAAgD,SAAAG,uBAAAW,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,SAAAf,wBAAAe,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,G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C;IAAoB,CAAC,GAAG,IAAAC,iBAAS,EAAC,CAAC;IAC3C,MAAMC,YAAY,GAChB,OAAO1C,OAAO,KAAK,QAAQ,GACvB;MAAE,GAAGwC,mBAAmB;MAAEG,OAAO,EAAE3C;IAAQ,CAAC,GAC5C;MAAE,GAAGwC,mBAAmB;MAAE,GAAGxC;IAAQ,CAAC;IAE5C,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC/B;MACA4C,OAAO,CAACC,IAAI,CACV,+HACF,CAAC;IACH;IAEA,MAAMC,IAAI,GAAGlC,QAAQ,CAACO,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","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,C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AC,MAAM;MACbhB,QAAQ,CAACW,MAAM,CAACd,IAAI,CAACd,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC;EACJ,CAAC;AACH;AAIA,SAASuC,SAASA,CAACT,QAA2B,EAAEb,QAA2B,EAAiB;EAC1F,SAAS4B,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/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E;EAC1DF,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGG,YAAY;AACvB;AAEO,SAASC,iBAAiBA,CAAA,EAAG;EAClCH,OAAA,CAAAD,MAAA,GAAAA,MAAM,GAAGvE,aAAa;AACxB","ignoreList":[]}
|
|
@@ -0,0 +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/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
|
@@ -12,34 +12,10 @@ export declare function within(instance: ReactTestInstance): {
|
|
|
12
12
|
UNSAFE_queryAllByProps: (props: {
|
|
13
13
|
[key: string]: any;
|
|
14
14
|
}) => Array<ReactTestInstance>;
|
|
15
|
-
UNSAFE_getByType: <P>(type:
|
|
16
|
-
UNSAFE_getAllByType: <P>(type:
|
|
17
|
-
UNSAFE_queryByType: <P>(type:
|
|
18
|
-
UNSAFE_queryAllByType: <P>(type:
|
|
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>;
|
|
15
|
+
UNSAFE_getByType: <P>(type: React.ComponentType<P>) => ReactTestInstance;
|
|
16
|
+
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
17
|
+
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
18
|
+
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
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",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"scripts": {
|
|
26
26
|
"clean": "del build",
|
|
27
27
|
"test": "jest",
|
|
28
|
-
"test:ci": "jest --maxWorkers=2
|
|
28
|
+
"test:ci": "jest --maxWorkers=2",
|
|
29
|
+
"test:ci:coverage": "jest --maxWorkers=2 --collectCoverage=true --coverage-provider=v8",
|
|
29
30
|
"typecheck": "tsc",
|
|
30
31
|
"copy-flowtypes": "cp typings/index.flow.js build",
|
|
31
32
|
"lint": "eslint src --cache",
|
|
@@ -33,13 +34,14 @@
|
|
|
33
34
|
"build:js": "babel src --out-dir build --extensions \".js,.ts,.jsx,.tsx\" --source-maps --ignore \"**/__tests__/**\"",
|
|
34
35
|
"build:ts": "tsc --build tsconfig.release.json",
|
|
35
36
|
"build": "yarn clean && yarn build:js && yarn build:ts && yarn copy-flowtypes",
|
|
36
|
-
"
|
|
37
|
+
"release": "release-it",
|
|
38
|
+
"release:alpha": "release-it --preRelease=alpha"
|
|
37
39
|
},
|
|
38
40
|
"files": [
|
|
39
41
|
"build/",
|
|
40
42
|
"jest-preset/",
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
+
"matchers.js",
|
|
44
|
+
"matchers.d.ts",
|
|
43
45
|
"pure.js",
|
|
44
46
|
"pure.d.ts",
|
|
45
47
|
"dont-cleanup-after-each.js",
|
|
@@ -51,10 +53,10 @@
|
|
|
51
53
|
"redent": "^3.0.0"
|
|
52
54
|
},
|
|
53
55
|
"peerDependencies": {
|
|
54
|
-
"jest": ">=
|
|
55
|
-
"react": ">=
|
|
56
|
-
"react-native": ">=0.
|
|
57
|
-
"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"
|
|
58
60
|
},
|
|
59
61
|
"peerDependenciesMeta": {
|
|
60
62
|
"jest": {
|
|
@@ -62,36 +64,39 @@
|
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
"devDependencies": {
|
|
65
|
-
"@babel/cli": "^7.
|
|
66
|
-
"@babel/core": "^7.25.
|
|
67
|
-
"@babel/plugin-transform-flow-strip-types": "^7.25.
|
|
68
|
-
"@babel/preset-env": "^7.25.
|
|
69
|
-
"@babel/preset-flow": "^7.
|
|
70
|
-
"@babel/preset-react": "^7.
|
|
71
|
-
"@babel/preset-typescript": "^7.
|
|
67
|
+
"@babel/cli": "^7.25.9",
|
|
68
|
+
"@babel/core": "^7.25.9",
|
|
69
|
+
"@babel/plugin-transform-flow-strip-types": "^7.25.9",
|
|
70
|
+
"@babel/preset-env": "^7.25.9",
|
|
71
|
+
"@babel/preset-flow": "^7.25.9",
|
|
72
|
+
"@babel/preset-react": "^7.25.9",
|
|
73
|
+
"@babel/preset-typescript": "^7.25.9",
|
|
72
74
|
"@callstack/eslint-config": "^15.0.0",
|
|
73
|
-
"@release-it/conventional-changelog": "^
|
|
75
|
+
"@release-it/conventional-changelog": "^9.0.1",
|
|
74
76
|
"@relmify/jest-serializer-strip-ansi": "^1.0.2",
|
|
75
|
-
"@types/jest": "^29.5.
|
|
76
|
-
"@types/react": "^18.3.
|
|
77
|
+
"@types/jest": "^29.5.14",
|
|
78
|
+
"@types/react": "^18.3.12",
|
|
77
79
|
"@types/react-test-renderer": "^18.3.0",
|
|
78
80
|
"babel-jest": "^29.7.0",
|
|
79
|
-
"del-cli": "^
|
|
80
|
-
"eslint": "^8.57.
|
|
81
|
+
"del-cli": "^6.0.0",
|
|
82
|
+
"eslint": "^8.57.1",
|
|
81
83
|
"eslint-plugin-flowtype": "^8.0.3",
|
|
82
84
|
"eslint-plugin-prettier": "^4.2.1",
|
|
83
85
|
"flow-bin": "~0.170.0",
|
|
84
86
|
"jest": "^29.7.0",
|
|
85
87
|
"prettier": "^2.8.8",
|
|
86
88
|
"react": "18.3.1",
|
|
87
|
-
"react-native": "0.
|
|
89
|
+
"react-native": "0.76.0",
|
|
88
90
|
"react-test-renderer": "18.3.1",
|
|
89
|
-
"release-it": "^17.
|
|
91
|
+
"release-it": "^17.10.0",
|
|
90
92
|
"strip-ansi": "^6.0.1",
|
|
91
93
|
"typescript": "^5.5.4"
|
|
92
94
|
},
|
|
93
95
|
"publishConfig": {
|
|
94
96
|
"registry": "https://registry.npmjs.org"
|
|
95
97
|
},
|
|
96
|
-
"packageManager": "yarn@4.4.0"
|
|
98
|
+
"packageManager": "yarn@4.4.0",
|
|
99
|
+
"engines": {
|
|
100
|
+
"node": ">=18"
|
|
101
|
+
}
|
|
97
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;
|