@testing-library/react-native 9.2.0 → 10.1.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 +4 -6
- package/build/cleanup.js +4 -0
- package/build/cleanup.js.map +1 -1
- package/build/index.flow.js +107 -95
- package/build/pure.d.ts +5 -1
- package/build/pure.js +8 -0
- package/build/pure.js.map +1 -1
- package/build/{helpers → queries}/a11yAPI.d.ts +0 -0
- package/build/{helpers → queries}/a11yAPI.js +0 -0
- package/build/{helpers → queries}/a11yAPI.js.map +1 -1
- package/build/queries/displayValue.d.ts +13 -0
- package/build/{helpers/byDisplayValue.js → queries/displayValue.js} +23 -18
- package/build/queries/displayValue.js.map +1 -0
- package/build/{helpers → queries}/makeA11yQuery.d.ts +0 -0
- package/build/{helpers → queries}/makeA11yQuery.js +1 -1
- package/build/{helpers → queries}/makeA11yQuery.js.map +1 -1
- package/build/queries/makeQueries.d.ts +19 -0
- package/build/{helpers → queries}/makeQueries.js +17 -16
- package/build/queries/makeQueries.js.map +1 -0
- package/build/queries/placeholderText.d.ts +13 -0
- package/build/{helpers/byPlaceholderText.js → queries/placeholderText.js} +23 -18
- package/build/queries/placeholderText.js.map +1 -0
- package/build/queries/testId.d.ts +13 -0
- package/build/{helpers/byTestId.js → queries/testId.js} +19 -14
- package/build/queries/testId.js.map +1 -0
- package/build/queries/text.d.ts +17 -0
- package/build/{helpers/byText.js → queries/text.js} +25 -20
- package/build/queries/text.js.map +1 -0
- package/build/queries/unsafeProps.d.ts +16 -0
- package/build/queries/unsafeProps.js +58 -0
- package/build/queries/unsafeProps.js.map +1 -0
- package/build/queries/unsafeType.d.ts +9 -0
- package/build/queries/unsafeType.js +54 -0
- package/build/queries/unsafeType.js.map +1 -0
- package/build/render.d.ts +35 -44
- package/build/render.js +7 -12
- package/build/render.js.map +1 -1
- package/build/screen.d.ts +4 -0
- package/build/screen.js +115 -0
- package/build/screen.js.map +1 -0
- package/build/within.d.ts +34 -44
- package/build/within.js +16 -7
- package/build/within.js.map +1 -1
- package/package.json +1 -1
- package/typings/index.flow.js +107 -95
- package/build/helpers/byDisplayValue.d.ts +0 -6
- package/build/helpers/byDisplayValue.js.map +0 -1
- package/build/helpers/byPlaceholderText.d.ts +0 -6
- package/build/helpers/byPlaceholderText.js.map +0 -1
- package/build/helpers/byTestId.d.ts +0 -6
- package/build/helpers/byTestId.js.map +0 -1
- package/build/helpers/byText.d.ts +0 -10
- package/build/helpers/byText.js.map +0 -1
- package/build/helpers/findByAPI.d.ts +0 -17
- package/build/helpers/findByAPI.js +0 -33
- package/build/helpers/findByAPI.js.map +0 -1
- package/build/helpers/getByAPI.d.ts +0 -31
- package/build/helpers/getByAPI.js +0 -83
- package/build/helpers/getByAPI.js.map +0 -1
- package/build/helpers/makeQueries.d.ts +0 -20
- package/build/helpers/makeQueries.js.map +0 -1
- package/build/helpers/queryByAPI.d.ts +0 -39
- package/build/helpers/queryByAPI.js +0 -87
- package/build/helpers/queryByAPI.js.map +0 -1
package/build/render.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ declare type Options = {
|
|
|
4
4
|
wrapper?: React.ComponentType<any>;
|
|
5
5
|
createNodeMock?: (element: React.ReactElement) => any;
|
|
6
6
|
};
|
|
7
|
+
export declare type RenderResult = ReturnType<typeof render>;
|
|
7
8
|
/**
|
|
8
9
|
* Renders test component deeply using react-test-renderer and exposes helpers
|
|
9
10
|
* to assert on the output.
|
|
@@ -87,56 +88,46 @@ export default function render<T>(component: React.ReactElement<T>, { wrapper: W
|
|
|
87
88
|
now?: number | undefined;
|
|
88
89
|
text?: string | undefined;
|
|
89
90
|
}, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance[]>;
|
|
90
|
-
findAllByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance[]>;
|
|
91
|
-
findAllByPlaceholder: () => void;
|
|
92
|
-
findAllByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance[]>;
|
|
93
|
-
findAllByTestId: (testId: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance[]>;
|
|
94
|
-
findAllByText: (text: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance[]>;
|
|
95
|
-
findByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance>;
|
|
96
|
-
findByPlaceholder: () => void;
|
|
97
|
-
findByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance>;
|
|
98
|
-
findByTestId: (testId: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance>;
|
|
99
|
-
findByText: (text: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<TestRenderer.ReactTestInstance>;
|
|
100
|
-
queryByText: (name: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance | null;
|
|
101
|
-
queryAllByText: (text: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance[];
|
|
102
|
-
queryByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance | null;
|
|
103
|
-
queryAllByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance[];
|
|
104
|
-
queryByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance | null;
|
|
105
|
-
queryAllByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance[];
|
|
106
|
-
queryByTestId: (testID: import("./matches").TextMatch) => TestRenderer.ReactTestInstance | null;
|
|
107
|
-
queryAllByTestId: (testID: import("./matches").TextMatch) => TestRenderer.ReactTestInstance[];
|
|
108
|
-
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => TestRenderer.ReactTestInstance | null;
|
|
109
|
-
UNSAFE_queryAllByType: <P_1>(type: React.ComponentType<P_1>) => TestRenderer.ReactTestInstance[];
|
|
110
|
-
UNSAFE_queryByProps: (props: {
|
|
111
|
-
[key: string]: any;
|
|
112
|
-
}) => TestRenderer.ReactTestInstance | null;
|
|
113
|
-
UNSAFE_queryAllByProps: (props: {
|
|
114
|
-
[key: string]: any;
|
|
115
|
-
}) => TestRenderer.ReactTestInstance[];
|
|
116
|
-
queryByName: () => void;
|
|
117
|
-
queryByType: () => void;
|
|
118
|
-
queryByProps: () => void;
|
|
119
|
-
queryAllByName: () => void;
|
|
120
|
-
queryAllByType: () => void;
|
|
121
|
-
queryAllByProps: () => void;
|
|
122
|
-
queryByPlaceholder: () => void;
|
|
123
|
-
queryAllByPlaceholder: () => void;
|
|
124
|
-
getByText: (text: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance;
|
|
125
|
-
getByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance;
|
|
126
|
-
getByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance;
|
|
127
|
-
getByTestId: (testID: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance;
|
|
128
|
-
getAllByTestId: (testID: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance[];
|
|
129
|
-
getAllByText: (text: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance[];
|
|
130
|
-
getAllByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance[];
|
|
131
|
-
getAllByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => TestRenderer.ReactTestInstance[];
|
|
132
|
-
UNSAFE_getByType: <P_2>(type: React.ComponentType<P_2>) => TestRenderer.ReactTestInstance;
|
|
133
|
-
UNSAFE_getAllByType: <P_3>(type: React.ComponentType<P_3>) => TestRenderer.ReactTestInstance[];
|
|
134
91
|
UNSAFE_getByProps: (props: {
|
|
135
92
|
[key: string]: any;
|
|
136
93
|
}) => TestRenderer.ReactTestInstance;
|
|
137
94
|
UNSAFE_getAllByProps: (props: {
|
|
138
95
|
[key: string]: any;
|
|
139
96
|
}) => TestRenderer.ReactTestInstance[];
|
|
97
|
+
UNSAFE_queryByProps: (props: {
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
}) => TestRenderer.ReactTestInstance | null;
|
|
100
|
+
UNSAFE_queryAllByProps: (props: {
|
|
101
|
+
[key: string]: any;
|
|
102
|
+
}) => TestRenderer.ReactTestInstance[];
|
|
103
|
+
UNSAFE_getByType: <P>(type: React.ComponentType<P>) => TestRenderer.ReactTestInstance;
|
|
104
|
+
UNSAFE_getAllByType: <P_1>(type: React.ComponentType<P_1>) => TestRenderer.ReactTestInstance[];
|
|
105
|
+
UNSAFE_queryByType: <P_2>(type: React.ComponentType<P_2>) => TestRenderer.ReactTestInstance | null;
|
|
106
|
+
UNSAFE_queryAllByType: <P_3>(type: React.ComponentType<P_3>) => TestRenderer.ReactTestInstance[];
|
|
107
|
+
getByPlaceholderText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
108
|
+
getAllByPlaceholderText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
109
|
+
queryByPlaceholderText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
110
|
+
queryAllByPlaceholderText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
111
|
+
findByPlaceholderText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
112
|
+
findAllByPlaceholderText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
113
|
+
getByDisplayValue: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
114
|
+
getAllByDisplayValue: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
115
|
+
queryByDisplayValue: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
116
|
+
queryAllByDisplayValue: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
117
|
+
findByDisplayValue: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
118
|
+
findAllByDisplayValue: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
119
|
+
getByTestId: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
120
|
+
getAllByTestId: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
121
|
+
queryByTestId: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
122
|
+
queryAllByTestId: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
123
|
+
findByTestId: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
124
|
+
findAllByTestId: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
125
|
+
getByText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
126
|
+
getAllByText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
127
|
+
queryByText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
128
|
+
queryAllByText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
129
|
+
findByText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
130
|
+
findAllByText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
140
131
|
};
|
|
141
132
|
interface DebugFunction {
|
|
142
133
|
(message?: string): void;
|
package/build/render.js
CHANGED
|
@@ -13,18 +13,14 @@ var _act = _interopRequireDefault(require("./act"));
|
|
|
13
13
|
|
|
14
14
|
var _cleanup = require("./cleanup");
|
|
15
15
|
|
|
16
|
-
var _getByAPI = require("./helpers/getByAPI");
|
|
17
|
-
|
|
18
|
-
var _queryByAPI = require("./helpers/queryByAPI");
|
|
19
|
-
|
|
20
|
-
var _findByAPI = require("./helpers/findByAPI");
|
|
21
|
-
|
|
22
|
-
var _a11yAPI = require("./helpers/a11yAPI");
|
|
23
|
-
|
|
24
16
|
var _debugShallow = _interopRequireDefault(require("./helpers/debugShallow"));
|
|
25
17
|
|
|
26
18
|
var _debugDeep = _interopRequireDefault(require("./helpers/debugDeep"));
|
|
27
19
|
|
|
20
|
+
var _within = require("./within");
|
|
21
|
+
|
|
22
|
+
var _screen = require("./screen");
|
|
23
|
+
|
|
28
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
25
|
|
|
30
26
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -54,10 +50,7 @@ function render(component, {
|
|
|
54
50
|
};
|
|
55
51
|
|
|
56
52
|
(0, _cleanup.addToCleanupQueue)(unmount);
|
|
57
|
-
|
|
58
|
-
...(0, _queryByAPI.queryByAPI)(instance),
|
|
59
|
-
...(0, _findByAPI.findByAPI)(instance),
|
|
60
|
-
...(0, _a11yAPI.a11yAPI)(instance),
|
|
53
|
+
const result = { ...(0, _within.getQueriesForElement)(instance),
|
|
61
54
|
update,
|
|
62
55
|
unmount,
|
|
63
56
|
container: instance,
|
|
@@ -66,6 +59,8 @@ function render(component, {
|
|
|
66
59
|
toJSON: renderer.toJSON,
|
|
67
60
|
debug: debug(instance, renderer)
|
|
68
61
|
};
|
|
62
|
+
(0, _screen.setRenderResult)(result);
|
|
63
|
+
return result;
|
|
69
64
|
}
|
|
70
65
|
|
|
71
66
|
function renderWithAct(component, options) {
|
package/build/render.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render.tsx"],"names":["render","component","wrapper","Wrapper","createNodeMock","wrap","innerElement","renderer","renderWithAct","undefined","update","updateWithAct","instance","root","unmount","container","rerender","toJSON","debug","options","TestRenderer","create","debugImpl","message","json","shallow"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA
|
|
1
|
+
{"version":3,"sources":["../src/render.tsx"],"names":["render","component","wrapper","Wrapper","createNodeMock","wrap","innerElement","renderer","renderWithAct","undefined","update","updateWithAct","instance","root","unmount","result","container","rerender","toJSON","debug","options","TestRenderer","create","debugImpl","message","json","shallow"],"mappings":";;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAYA;AACA;AACA;AACA;AACe,SAASA,MAAT,CACbC,SADa,EAEb;AAAEC,EAAAA,OAAO,EAAEC,OAAX;AAAoBC,EAAAA;AAApB,IAAgD,EAFnC,EAGb;AACA,QAAMC,IAAI,GAAIC,YAAD,IACXH,OAAO,gBAAG,oBAAC,OAAD,QAA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T,CAAmBC,OAAnB,EAAqC;AACnC,UAAMC,IAAI,GAAGlB,QAAQ,CAACW,MAAT,EAAb;;AACA,QAAIO,IAAJ,EAAU;AACR,aAAO,wBAAUA,IAAV,EAAgBD,OAAhB,CAAP;AACD;AACF;;AACDD,EAAAA,SAAS,CAACG,OAAV,GAAqBF,OAAD,IAAsB,2BAAaZ,QAAb,EAAuBY,OAAvB,CAA1C;;AACA,SAAOD,SAAP;AACD","sourcesContent":["import TestRenderer from 'react-test-renderer';\nimport type { ReactTestInstance, ReactTestRenderer } from 'react-test-renderer';\nimport * as React from 'react';\nimport act from './act';\nimport { addToCleanupQueue } from './cleanup';\nimport debugShallow from './helpers/debugShallow';\nimport debugDeep from './helpers/debugDeep';\nimport { getQueriesForElement } from './within';\nimport { setRenderResult } from './screen';\n\ntype Options = {\n wrapper?: React.ComponentType<any>;\n createNodeMock?: (element: React.ReactElement) => any;\n};\ntype TestRendererOptions = {\n createNodeMock: (element: React.ReactElement) => any;\n};\n\nexport type RenderResult = ReturnType<typeof render>;\n\n/**\n * Renders test component deeply using react-test-renderer and exposes helpers\n * to assert on the output.\n */\nexport default function render<T>(\n component: React.ReactElement<T>,\n { wrapper: Wrapper, createNodeMock }: Options = {}\n) {\n const wrap = (innerElement: React.ReactElement) =>\n Wrapper ? <Wrapper>{innerElement}</Wrapper> : innerElement;\n\n const renderer = renderWithAct(\n wrap(component),\n createNodeMock ? { createNodeMock } : undefined\n );\n const update = updateWithAct(renderer, wrap);\n const instance = renderer.root;\n const unmount = () => {\n act(() => {\n renderer.unmount();\n });\n };\n\n addToCleanupQueue(unmount);\n\n const result = {\n ...getQueriesForElement(instance),\n update,\n unmount,\n container: instance,\n rerender: update, // alias for `update`\n toJSON: renderer.toJSON,\n debug: debug(instance, renderer),\n };\n\n setRenderResult(result);\n return result;\n}\n\nfunction renderWithAct(\n component: React.ReactElement,\n options?: TestRendererOptions\n): ReactTestRenderer {\n let renderer: ReactTestRenderer;\n\n act(() => {\n renderer = TestRenderer.create(component, options);\n });\n\n // @ts-ignore act is sync, so renderer is always initialised here\n return renderer;\n}\n\nfunction updateWithAct(\n renderer: ReactTestRenderer,\n wrap: (innerElement: React.ReactElement) => React.ReactElement\n) {\n return function (component: React.ReactElement) {\n act(() => {\n renderer.update(wrap(component));\n });\n };\n}\n\ninterface DebugFunction {\n (message?: string): void;\n shallow: (message?: string) => void;\n}\n\nfunction debug(\n instance: ReactTestInstance,\n renderer: ReactTestRenderer\n): DebugFunction {\n function debugImpl(message?: string) {\n const json = renderer.toJSON();\n if (json) {\n return debugDeep(json, message);\n }\n }\n debugImpl.shallow = (message?: string) => debugShallow(instance, message);\n return debugImpl;\n}\n"],"file":"render.js"}
|
package/build/screen.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.clearRenderResult = clearRenderResult;
|
|
7
|
+
exports.screen = void 0;
|
|
8
|
+
exports.setRenderResult = setRenderResult;
|
|
9
|
+
const SCREEN_ERROR = '`render` method has not been called';
|
|
10
|
+
|
|
11
|
+
const notImplemented = () => {
|
|
12
|
+
throw new Error(SCREEN_ERROR);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const notImplementedDebug = () => {
|
|
16
|
+
throw new Error(SCREEN_ERROR);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
notImplementedDebug.shallow = notImplemented;
|
|
20
|
+
const defaultScreen = {
|
|
21
|
+
get container() {
|
|
22
|
+
throw new Error(SCREEN_ERROR);
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
debug: notImplementedDebug,
|
|
26
|
+
update: notImplemented,
|
|
27
|
+
unmount: notImplemented,
|
|
28
|
+
rerender: notImplemented,
|
|
29
|
+
toJSON: notImplemented,
|
|
30
|
+
getByLabelText: notImplemented,
|
|
31
|
+
getAllByLabelText: notImplemented,
|
|
32
|
+
queryByLabelText: notImplemented,
|
|
33
|
+
queryAllByLabelText: notImplemented,
|
|
34
|
+
findByLabelText: notImplemented,
|
|
35
|
+
findAllByLabelText: notImplemented,
|
|
36
|
+
getByA11yHint: notImplemented,
|
|
37
|
+
getByHintText: notImplemented,
|
|
38
|
+
getAllByA11yHint: notImplemented,
|
|
39
|
+
getAllByHintText: notImplemented,
|
|
40
|
+
queryByA11yHint: notImplemented,
|
|
41
|
+
queryByHintText: notImplemented,
|
|
42
|
+
queryAllByA11yHint: notImplemented,
|
|
43
|
+
queryAllByHintText: notImplemented,
|
|
44
|
+
findByA11yHint: notImplemented,
|
|
45
|
+
findByHintText: notImplemented,
|
|
46
|
+
findAllByA11yHint: notImplemented,
|
|
47
|
+
findAllByHintText: notImplemented,
|
|
48
|
+
getByRole: notImplemented,
|
|
49
|
+
getAllByRole: notImplemented,
|
|
50
|
+
queryByRole: notImplemented,
|
|
51
|
+
queryAllByRole: notImplemented,
|
|
52
|
+
findByRole: notImplemented,
|
|
53
|
+
findAllByRole: notImplemented,
|
|
54
|
+
getByA11yStates: notImplemented,
|
|
55
|
+
getAllByA11yStates: notImplemented,
|
|
56
|
+
queryByA11yStates: notImplemented,
|
|
57
|
+
queryAllByA11yStates: notImplemented,
|
|
58
|
+
findByA11yStates: notImplemented,
|
|
59
|
+
findAllByA11yStates: notImplemented,
|
|
60
|
+
getByA11yState: notImplemented,
|
|
61
|
+
getAllByA11yState: notImplemented,
|
|
62
|
+
queryByA11yState: notImplemented,
|
|
63
|
+
queryAllByA11yState: notImplemented,
|
|
64
|
+
findByA11yState: notImplemented,
|
|
65
|
+
findAllByA11yState: notImplemented,
|
|
66
|
+
getByA11yValue: notImplemented,
|
|
67
|
+
getAllByA11yValue: notImplemented,
|
|
68
|
+
queryByA11yValue: notImplemented,
|
|
69
|
+
queryAllByA11yValue: notImplemented,
|
|
70
|
+
findByA11yValue: notImplemented,
|
|
71
|
+
findAllByA11yValue: notImplemented,
|
|
72
|
+
UNSAFE_getByProps: notImplemented,
|
|
73
|
+
UNSAFE_getAllByProps: notImplemented,
|
|
74
|
+
UNSAFE_queryByProps: notImplemented,
|
|
75
|
+
UNSAFE_queryAllByProps: notImplemented,
|
|
76
|
+
UNSAFE_getByType: notImplemented,
|
|
77
|
+
UNSAFE_getAllByType: notImplemented,
|
|
78
|
+
UNSAFE_queryByType: notImplemented,
|
|
79
|
+
UNSAFE_queryAllByType: notImplemented,
|
|
80
|
+
getByPlaceholderText: notImplemented,
|
|
81
|
+
getAllByPlaceholderText: notImplemented,
|
|
82
|
+
queryByPlaceholderText: notImplemented,
|
|
83
|
+
queryAllByPlaceholderText: notImplemented,
|
|
84
|
+
findByPlaceholderText: notImplemented,
|
|
85
|
+
findAllByPlaceholderText: notImplemented,
|
|
86
|
+
getByDisplayValue: notImplemented,
|
|
87
|
+
getAllByDisplayValue: notImplemented,
|
|
88
|
+
queryByDisplayValue: notImplemented,
|
|
89
|
+
queryAllByDisplayValue: notImplemented,
|
|
90
|
+
findByDisplayValue: notImplemented,
|
|
91
|
+
findAllByDisplayValue: notImplemented,
|
|
92
|
+
getByTestId: notImplemented,
|
|
93
|
+
getAllByTestId: notImplemented,
|
|
94
|
+
queryByTestId: notImplemented,
|
|
95
|
+
queryAllByTestId: notImplemented,
|
|
96
|
+
findByTestId: notImplemented,
|
|
97
|
+
findAllByTestId: notImplemented,
|
|
98
|
+
getByText: notImplemented,
|
|
99
|
+
getAllByText: notImplemented,
|
|
100
|
+
queryByText: notImplemented,
|
|
101
|
+
queryAllByText: notImplemented,
|
|
102
|
+
findByText: notImplemented,
|
|
103
|
+
findAllByText: notImplemented
|
|
104
|
+
};
|
|
105
|
+
let screen = defaultScreen;
|
|
106
|
+
exports.screen = screen;
|
|
107
|
+
|
|
108
|
+
function setRenderResult(output) {
|
|
109
|
+
exports.screen = screen = output;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function clearRenderResult() {
|
|
113
|
+
exports.screen = screen = defaultScreen;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=screen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/screen.ts"],"names":["SCREEN_ERROR","notImplemented","Error","notImplementedDebug","shallow","defaultScreen","container","debug","update","unmount","rerender","toJSON","getByLabelText","getAllByLabelText","queryByLabelText","queryAllByLabelText","findByLabelText","findAllByLabelText","getByA11yHint","getByHintText","getAllByA11yHint","getAllByHintText","queryByA11yHint","queryByHintText","queryAllByA11yHint","queryAllByHintText","findByA11yHint","findByHintText","findAllByA11yHint","findAllByHintText","getByRole","getAllByRole","queryByRole","queryAllByRole","findByRole","findAllByRole","getByA11yStates","getAllByA11yStates","queryByA11yStates","queryAllByA11yStates","findByA11yStates","findAllByA11yStates","getByA11yState","getAllByA11yState","queryByA11yState","queryAllByA11yState","findByA11yState","findAllByA11yState","getByA11yValue","getAllByA11yValue","queryByA11yValue","queryAllByA11yValue","findByA11yValue","findAllByA11yValue","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","setRenderResult","output","clearRenderResult"],"mappings":";;;;;;;;AAGA,MAAMA,YAAY,GAAG,qCAArB;;AAEA,MAAMC,cAAc,GAAG,MAAM;AAC3B,QAAM,IAAIC,KAAJ,CAAUF,YAAV,CAAN;AACD,CAFD;;AAIA,MAAMG,mBAAmB,GAAG,MAAM;AAChC,QAAM,IAAID,KAAJ,CAAUF,YAAV,CAAN;AACD,CAFD;;AAGAG,mB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sBAAsB,EAAE/D,cA7DU;AA8DlCgE,EAAAA,yBAAyB,EAAEhE,cA9DO;AA+DlCiE,EAAAA,qBAAqB,EAAEjE,cA/DW;AAgElCkE,EAAAA,wBAAwB,EAAElE,cAhEQ;AAiElCmE,EAAAA,iBAAiB,EAAEnE,cAjEe;AAkElCoE,EAAAA,oBAAoB,EAAEpE,cAlEY;AAmElCqE,EAAAA,mBAAmB,EAAErE,cAnEa;AAoElCsE,EAAAA,sBAAsB,EAAEtE,cApEU;AAqElCuE,EAAAA,kBAAkB,EAAEvE,cArEc;AAsElCwE,EAAAA,qBAAqB,EAAExE,cAtEW;AAuElCyE,EAAAA,WAAW,EAAEzE,cAvEqB;AAwElC0E,EAAAA,cAAc,EAAE1E,cAxEkB;AAyElC2E,EAAAA,aAAa,EAAE3E,cAzEmB;AA0ElC4E,EAAAA,gBAAgB,EAAE5E,cA1EgB;AA2ElC6E,EAAAA,YAAY,EAAE7E,cA3EoB;AA4ElC8E,EAAAA,eAAe,EAAE9E,cA5EiB;AA6ElC+E,EAAAA,SAAS,EAAE/E,cA7EuB;AA8ElCgF,EAAAA,YAAY,EAAEhF,cA9EoB;AA+ElCiF,EAAAA,WAAW,EAAEjF,cA/EqB;AAgFlCkF,EAAAA,cAAc,EAAElF,cAhFkB;AAiFlCmF,EAAAA,UAAU,EAAEnF,cAjFsB;AAkFlCoF,EAAAA,aAAa,EAAEpF;AAlFmB,CAApC;AAqFO,IAAIqF,MAAoB,GAAGjF,aAA3B;;;AAEA,SAASkF,eAAT,CAAyBC,MAAzB,EAA+C;AACpD,mBAAAF,MAAM,GAAGE,MAAT;AACD;;AAEM,SAASC,iBAAT,GAA6B;AAClC,mBAAAH,MAAM,GAAGjF,aAAT;AACD","sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { RenderResult } from './render';\n\nconst SCREEN_ERROR = '`render` method has not been called';\n\nconst notImplemented = () => {\n throw new Error(SCREEN_ERROR);\n};\n\nconst notImplementedDebug = () => {\n throw new Error(SCREEN_ERROR);\n};\nnotImplementedDebug.shallow = notImplemented;\n\nconst defaultScreen: RenderResult = {\n get container(): 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 getByA11yHint: notImplemented,\n getByHintText: notImplemented,\n getAllByA11yHint: notImplemented,\n getAllByHintText: notImplemented,\n queryByA11yHint: notImplemented,\n queryByHintText: notImplemented,\n queryAllByA11yHint: notImplemented,\n queryAllByHintText: notImplemented,\n findByA11yHint: notImplemented,\n findByHintText: notImplemented,\n findAllByA11yHint: notImplemented,\n findAllByHintText: notImplemented,\n getByRole: notImplemented,\n getAllByRole: notImplemented,\n queryByRole: notImplemented,\n queryAllByRole: notImplemented,\n findByRole: notImplemented,\n findAllByRole: notImplemented,\n getByA11yStates: notImplemented,\n getAllByA11yStates: notImplemented,\n queryByA11yStates: notImplemented,\n queryAllByA11yStates: notImplemented,\n findByA11yStates: notImplemented,\n findAllByA11yStates: notImplemented,\n getByA11yState: notImplemented,\n getAllByA11yState: notImplemented,\n queryByA11yState: notImplemented,\n queryAllByA11yState: notImplemented,\n findByA11yState: notImplemented,\n findAllByA11yState: notImplemented,\n getByA11yValue: notImplemented,\n getAllByA11yValue: notImplemented,\n queryByA11yValue: notImplemented,\n queryAllByA11yValue: notImplemented,\n findByA11yValue: notImplemented,\n findAllByA11yValue: notImplemented,\n UNSAFE_getByProps: notImplemented,\n UNSAFE_getAllByProps: notImplemented,\n UNSAFE_queryByProps: notImplemented,\n UNSAFE_queryAllByProps: notImplemented,\n UNSAFE_getByType: notImplemented,\n UNSAFE_getAllByType: notImplemented,\n UNSAFE_queryByType: notImplemented,\n UNSAFE_queryAllByType: notImplemented,\n getByPlaceholderText: notImplemented,\n getAllByPlaceholderText: notImplemented,\n queryByPlaceholderText: notImplemented,\n queryAllByPlaceholderText: notImplemented,\n findByPlaceholderText: notImplemented,\n findAllByPlaceholderText: notImplemented,\n getByDisplayValue: notImplemented,\n getAllByDisplayValue: notImplemented,\n queryByDisplayValue: notImplemented,\n queryAllByDisplayValue: notImplemented,\n findByDisplayValue: notImplemented,\n findAllByDisplayValue: notImplemented,\n getByTestId: notImplemented,\n getAllByTestId: notImplemented,\n queryByTestId: notImplemented,\n queryAllByTestId: notImplemented,\n findByTestId: notImplemented,\n findAllByTestId: notImplemented,\n getByText: notImplemented,\n getAllByText: notImplemented,\n queryByText: notImplemented,\n queryAllByText: notImplemented,\n findByText: notImplemented,\n findAllByText: notImplemented,\n};\n\nexport let screen: RenderResult = defaultScreen;\n\nexport function setRenderResult(output: RenderResult) {\n screen = output;\n}\n\nexport function clearRenderResult() {\n screen = defaultScreen;\n}\n"],"file":"screen.js"}
|
package/build/within.d.ts
CHANGED
|
@@ -73,55 +73,45 @@ export declare function within(instance: ReactTestInstance): {
|
|
|
73
73
|
now?: number | undefined;
|
|
74
74
|
text?: string | undefined;
|
|
75
75
|
}, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
76
|
-
findAllByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
77
|
-
findAllByPlaceholder: () => void;
|
|
78
|
-
findAllByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
79
|
-
findAllByTestId: (testId: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
80
|
-
findAllByText: (text: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
81
|
-
findByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance>;
|
|
82
|
-
findByPlaceholder: () => void;
|
|
83
|
-
findByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance>;
|
|
84
|
-
findByTestId: (testId: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance>;
|
|
85
|
-
findByText: (text: import("./matches").TextMatch, queryOptions?: (import("./helpers/byText").TextMatchOptions & import("./waitFor").WaitForOptions) | undefined, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance>;
|
|
86
|
-
queryByText: (name: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance | null;
|
|
87
|
-
queryAllByText: (text: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance[];
|
|
88
|
-
queryByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance | null;
|
|
89
|
-
queryAllByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance[];
|
|
90
|
-
queryByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance | null;
|
|
91
|
-
queryAllByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance[];
|
|
92
|
-
queryByTestId: (testID: import("./matches").TextMatch) => ReactTestInstance | null;
|
|
93
|
-
queryAllByTestId: (testID: import("./matches").TextMatch) => ReactTestInstance[];
|
|
94
|
-
UNSAFE_queryByType: <P>(type: import("react").ComponentType<P>) => ReactTestInstance | null;
|
|
95
|
-
UNSAFE_queryAllByType: <P_1>(type: import("react").ComponentType<P_1>) => ReactTestInstance[];
|
|
96
|
-
UNSAFE_queryByProps: (props: {
|
|
97
|
-
[key: string]: any;
|
|
98
|
-
}) => ReactTestInstance | null;
|
|
99
|
-
UNSAFE_queryAllByProps: (props: {
|
|
100
|
-
[key: string]: any;
|
|
101
|
-
}) => ReactTestInstance[];
|
|
102
|
-
queryByName: () => void;
|
|
103
|
-
queryByType: () => void;
|
|
104
|
-
queryByProps: () => void;
|
|
105
|
-
queryAllByName: () => void;
|
|
106
|
-
queryAllByType: () => void;
|
|
107
|
-
queryAllByProps: () => void;
|
|
108
|
-
queryByPlaceholder: () => void;
|
|
109
|
-
queryAllByPlaceholder: () => void;
|
|
110
|
-
getByText: (text: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance;
|
|
111
|
-
getByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance;
|
|
112
|
-
getByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance;
|
|
113
|
-
getByTestId: (testID: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance;
|
|
114
|
-
getAllByTestId: (testID: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance[];
|
|
115
|
-
getAllByText: (text: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance[];
|
|
116
|
-
getAllByPlaceholderText: (placeholder: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance[];
|
|
117
|
-
getAllByDisplayValue: (value: import("./matches").TextMatch, queryOptions?: import("./helpers/byText").TextMatchOptions | undefined) => ReactTestInstance[];
|
|
118
|
-
UNSAFE_getByType: <P_2>(type: import("react").ComponentType<P_2>) => ReactTestInstance;
|
|
119
|
-
UNSAFE_getAllByType: <P_3>(type: import("react").ComponentType<P_3>) => ReactTestInstance[];
|
|
120
76
|
UNSAFE_getByProps: (props: {
|
|
121
77
|
[key: string]: any;
|
|
122
78
|
}) => ReactTestInstance;
|
|
123
79
|
UNSAFE_getAllByProps: (props: {
|
|
124
80
|
[key: string]: any;
|
|
125
81
|
}) => ReactTestInstance[];
|
|
82
|
+
UNSAFE_queryByProps: (props: {
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
}) => ReactTestInstance | null;
|
|
85
|
+
UNSAFE_queryAllByProps: (props: {
|
|
86
|
+
[key: string]: any;
|
|
87
|
+
}) => ReactTestInstance[];
|
|
88
|
+
UNSAFE_getByType: <P>(type: import("react").ComponentType<P>) => ReactTestInstance;
|
|
89
|
+
UNSAFE_getAllByType: <P_1>(type: import("react").ComponentType<P_1>) => ReactTestInstance[];
|
|
90
|
+
UNSAFE_queryByType: <P_2>(type: import("react").ComponentType<P_2>) => ReactTestInstance | null;
|
|
91
|
+
UNSAFE_queryAllByType: <P_3>(type: import("react").ComponentType<P_3>) => ReactTestInstance[];
|
|
92
|
+
getByPlaceholderText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
93
|
+
getAllByPlaceholderText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
94
|
+
queryByPlaceholderText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
95
|
+
queryAllByPlaceholderText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
96
|
+
findByPlaceholderText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
97
|
+
findAllByPlaceholderText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
98
|
+
getByDisplayValue: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
99
|
+
getAllByDisplayValue: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
100
|
+
queryByDisplayValue: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
101
|
+
queryAllByDisplayValue: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
102
|
+
findByDisplayValue: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
103
|
+
findAllByDisplayValue: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
104
|
+
getByTestId: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
105
|
+
getAllByTestId: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
106
|
+
queryByTestId: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
107
|
+
queryAllByTestId: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
108
|
+
findByTestId: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
109
|
+
findAllByTestId: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
110
|
+
getByText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
111
|
+
getAllByText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
112
|
+
queryByText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
113
|
+
queryAllByText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
114
|
+
findByText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
115
|
+
findAllByText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
126
116
|
};
|
|
127
117
|
export declare const getQueriesForElement: typeof within;
|
package/build/within.js
CHANGED
|
@@ -6,18 +6,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getQueriesForElement = void 0;
|
|
7
7
|
exports.within = within;
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _a11yAPI = require("./queries/a11yAPI");
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _text = require("./queries/text");
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _testId = require("./queries/testId");
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _displayValue = require("./queries/displayValue");
|
|
16
|
+
|
|
17
|
+
var _placeholderText = require("./queries/placeholderText");
|
|
18
|
+
|
|
19
|
+
var _unsafeType = require("./queries/unsafeType");
|
|
20
|
+
|
|
21
|
+
var _unsafeProps = require("./queries/unsafeProps");
|
|
16
22
|
|
|
17
23
|
function within(instance) {
|
|
18
|
-
return { ...(0,
|
|
19
|
-
...(0,
|
|
20
|
-
...(0,
|
|
24
|
+
return { ...(0, _text.bindByTextQueries)(instance),
|
|
25
|
+
...(0, _testId.bindByTestIdQueries)(instance),
|
|
26
|
+
...(0, _displayValue.bindByDisplayValueQueries)(instance),
|
|
27
|
+
...(0, _placeholderText.bindByPlaceholderTextQueries)(instance),
|
|
28
|
+
...(0, _unsafeType.bindUnsafeByTypeQueries)(instance),
|
|
29
|
+
...(0, _unsafeProps.bindUnsafeByPropsQueries)(instance),
|
|
21
30
|
...(0, _a11yAPI.a11yAPI)(instance)
|
|
22
31
|
};
|
|
23
32
|
}
|
package/build/within.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/within.ts"],"names":["within","instance","getQueriesForElement"],"mappings":";;;;;;;;AACA;;AACA;;AACA;;AACA;;AAEO,SAASA,MAAT,CAAgBC,QAAhB,EAA6C;AAClD,SAAO,EACL,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/within.ts"],"names":["within","instance","getQueriesForElement"],"mappings":";;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEO,SAASA,MAAT,CAAgBC,QAAhB,EAA6C;AAClD,SAAO,EACL,GAAG,6BAAkBA,QAAlB,CADE;AAEL,OAAG,iCAAoBA,QAApB,CAFE;AAGL,OAAG,6CAA0BA,QAA1B,CAHE;AAIL,OAAG,mDAA6BA,QAA7B,CAJE;AAKL,OAAG,yCAAwBA,QAAxB,CALE;AAML,OAAG,2CAAyBA,QAAzB,CANE;AAOL,OAAG,sBAAQA,QAAR;AAPE,GAAP;AASD;;AAEM,MAAMC,oBAAoB,GAAGF,MAA7B","sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { a11yAPI } from './queries/a11yAPI';\nimport { bindByTextQueries } from './queries/text';\nimport { bindByTestIdQueries } from './queries/testId';\nimport { bindByDisplayValueQueries } from './queries/displayValue';\nimport { bindByPlaceholderTextQueries } from './queries/placeholderText';\nimport { bindUnsafeByTypeQueries } from './queries/unsafeType';\nimport { bindUnsafeByPropsQueries } from './queries/unsafeProps';\n\nexport function within(instance: ReactTestInstance) {\n return {\n ...bindByTextQueries(instance),\n ...bindByTestIdQueries(instance),\n ...bindByDisplayValueQueries(instance),\n ...bindByPlaceholderTextQueries(instance),\n ...bindUnsafeByTypeQueries(instance),\n ...bindUnsafeByPropsQueries(instance),\n ...a11yAPI(instance),\n };\n}\n\nexport const getQueriesForElement = within;\n"],"file":"within.js"}
|
package/package.json
CHANGED