@testing-library/react-native 12.8.0 → 13.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -5
- package/build/act.d.ts +2 -1
- package/build/act.js +14 -10
- package/build/act.js.map +1 -1
- package/build/config.d.ts +5 -5
- package/build/config.js +1 -1
- package/build/config.js.map +1 -1
- package/build/flush-micro-tasks.d.ts +0 -18
- package/build/flush-micro-tasks.js +0 -25
- package/build/flush-micro-tasks.js.map +1 -1
- package/build/helpers/{debug-deep.d.ts → debug.d.ts} +1 -1
- package/build/helpers/{debug-deep.js → debug.js} +3 -3
- package/build/helpers/debug.js.map +1 -0
- package/build/helpers/wrap-async.js +10 -27
- package/build/helpers/wrap-async.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.flow.js +4 -37
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/render.d.ts +5 -56
- package/build/render.js +5 -7
- package/build/render.js.map +1 -1
- package/build/screen.js +0 -25
- package/build/screen.js.map +1 -1
- package/build/tsconfig.release.tsbuildinfo +1 -1
- package/build/within.d.ts +0 -24
- package/build/within.js +0 -4
- package/build/within.js.map +1 -1
- package/matchers.d.ts +1 -0
- package/matchers.js +2 -0
- package/package.json +13 -9
- package/typings/index.flow.js +4 -37
- package/build/helpers/debug-deep.js.map +0 -1
- package/build/helpers/debug-shallow.d.ts +0 -6
- package/build/helpers/debug-shallow.js +0 -25
- package/build/helpers/debug-shallow.js.map +0 -1
- package/build/queries/accessibility-state.d.ts +0 -19
- package/build/queries/accessibility-state.js +0 -59
- package/build/queries/accessibility-state.js.map +0 -1
- package/build/queries/accessibility-value.d.ts +0 -19
- package/build/queries/accessibility-value.js +0 -59
- package/build/queries/accessibility-value.js.map +0 -1
- package/build/shallow.d.ts +0 -8
- package/build/shallow.js +0 -24
- package/build/shallow.js.map +0 -1
- package/extend-expect.d.ts +0 -1
- package/extend-expect.js +0 -1
package/README.md
CHANGED
|
@@ -44,11 +44,7 @@ This library has a `peerDependencies` listing for `react-test-renderer`. Make su
|
|
|
44
44
|
|
|
45
45
|
### Additional Jest matchers
|
|
46
46
|
|
|
47
|
-
You can use the built-in Jest matchers by
|
|
48
|
-
|
|
49
|
-
```ts
|
|
50
|
-
import '@testing-library/react-native/extend-expect';
|
|
51
|
-
```
|
|
47
|
+
You can use the built-in Jest matchers automatically by having any import from `@testing-library/react-native` in your test.
|
|
52
48
|
|
|
53
49
|
## Example
|
|
54
50
|
|
package/build/act.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import { act as reactTestRendererAct } from 'react-test-renderer';
|
|
2
|
-
type ReactAct = typeof reactTestRendererAct;
|
|
3
|
+
type ReactAct = 0 extends 1 & typeof React.act ? typeof reactTestRendererAct : typeof React.act;
|
|
3
4
|
declare global {
|
|
4
5
|
var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;
|
|
5
6
|
}
|
package/build/act.js
CHANGED
|
@@ -6,10 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
exports.getIsReactActEnvironment = getIsReactActEnvironment;
|
|
8
8
|
exports.setReactActEnvironment = setIsReactActEnvironment;
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _reactTestRenderer = require("react-test-renderer");
|
|
10
|
-
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
11
13
|
// This file and the act() implementation is sourced from react-testing-library
|
|
12
|
-
// https://github.com/testing-library/react-testing-library/blob/
|
|
14
|
+
// https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/types/index.d.ts
|
|
15
|
+
|
|
16
|
+
const reactAct = typeof React.act === 'function' ? React.act : _reactTestRenderer.act;
|
|
13
17
|
|
|
14
18
|
// See https://github.com/reactwg/react-18/discussions/102 for more context on global.IS_REACT_ACT_ENVIRONMENT
|
|
15
19
|
|
|
@@ -23,17 +27,13 @@ function withGlobalActEnvironment(actImplementation) {
|
|
|
23
27
|
return callback => {
|
|
24
28
|
const previousActEnvironment = getIsReactActEnvironment();
|
|
25
29
|
setIsReactActEnvironment(true);
|
|
26
|
-
|
|
27
|
-
// this code is riddled with eslint disabling comments because this doesn't use real promises but eslint thinks we do
|
|
28
30
|
try {
|
|
29
31
|
// The return value of `act` is always a thenable.
|
|
30
32
|
let callbackNeedsToBeAwaited = false;
|
|
31
33
|
const actResult = actImplementation(() => {
|
|
32
34
|
const result = callback();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// eslint-disable-next-line promise/prefer-await-to-then
|
|
36
|
-
typeof result.then === 'function') {
|
|
35
|
+
// @ts-expect-error TS is too strict here
|
|
36
|
+
if (result !== null && typeof result === 'object' && typeof result.then === 'function') {
|
|
37
37
|
callbackNeedsToBeAwaited = true;
|
|
38
38
|
}
|
|
39
39
|
return result;
|
|
@@ -42,14 +42,16 @@ function withGlobalActEnvironment(actImplementation) {
|
|
|
42
42
|
const thenable = actResult;
|
|
43
43
|
return {
|
|
44
44
|
then: (resolve, reject) => {
|
|
45
|
-
// eslint-disable-next-line
|
|
45
|
+
// eslint-disable-next-line promise/catch-or-return, promise/prefer-await-to-then
|
|
46
46
|
thenable.then(
|
|
47
47
|
// eslint-disable-next-line promise/always-return
|
|
48
48
|
returnValue => {
|
|
49
49
|
setIsReactActEnvironment(previousActEnvironment);
|
|
50
|
+
// @ts-expect-error
|
|
50
51
|
resolve(returnValue);
|
|
51
52
|
}, error => {
|
|
52
53
|
setIsReactActEnvironment(previousActEnvironment);
|
|
54
|
+
// @ts-expect-error
|
|
53
55
|
reject(error);
|
|
54
56
|
});
|
|
55
57
|
}
|
|
@@ -66,6 +68,8 @@ function withGlobalActEnvironment(actImplementation) {
|
|
|
66
68
|
}
|
|
67
69
|
};
|
|
68
70
|
}
|
|
69
|
-
|
|
71
|
+
|
|
72
|
+
// @ts-expect-error
|
|
73
|
+
const act = withGlobalActEnvironment(reactAct);
|
|
70
74
|
var _default = exports.default = act;
|
|
71
75
|
//# sourceMappingURL=act.js.map
|
package/build/act.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"act.js","names":["
|
|
1
|
+
{"version":3,"file":"act.js","names":["React","_interopRequireWildcard","require","_reactTestRenderer","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","reactAct","act","reactTestRendererAct","setIsReactActEnvironment","isReactActEnvironment","globalThis","IS_REACT_ACT_ENVIRONMENT","getIsReactActEnvironment","withGlobalActEnvironment","actImplementation","callback","previousActEnvironment","callbackNeedsToBeAwaited","actResult","result","then","thenable","resolve","reject","returnValue","error","_default","exports"],"sources":["../src/act.ts"],"sourcesContent":["// This file and the act() implementation is sourced from react-testing-library\n// https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/types/index.d.ts\nimport * as React from 'react';\nimport { act as reactTestRendererAct } from 'react-test-renderer';\n\nconst reactAct = typeof React.act === 'function' ? React.act : reactTestRendererAct;\ntype ReactAct = 0 extends 1 & typeof React.act ? typeof reactTestRendererAct : typeof React.act;\n\n// See https://github.com/reactwg/react-18/discussions/102 for more context on global.IS_REACT_ACT_ENVIRONMENT\ndeclare global {\n var IS_REACT_ACT_ENVIRONMENT: boolean | undefined;\n}\n\nfunction setIsReactActEnvironment(isReactActEnvironment: boolean | undefined) {\n globalThis.IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment;\n}\n\nfunction getIsReactActEnvironment() {\n return globalThis.IS_REACT_ACT_ENVIRONMENT;\n}\n\nfunction withGlobalActEnvironment(actImplementation: ReactAct) {\n return (callback: Parameters<ReactAct>[0]) => {\n const previousActEnvironment = getIsReactActEnvironment();\n setIsReactActEnvironment(true);\n\n try {\n // The return value of `act` is always a thenable.\n let callbackNeedsToBeAwaited = false;\n const actResult = actImplementation(() => {\n const result = callback();\n // @ts-expect-error TS is too strict here\n if (result !== null && typeof result === 'object' && typeof result.then === 'function') {\n callbackNeedsToBeAwaited = true;\n }\n return result;\n });\n\n if (callbackNeedsToBeAwaited) {\n const thenable = actResult;\n return {\n then: (resolve: (value: never) => never, reject: (value: never) => never) => {\n // eslint-disable-next-line promise/catch-or-return, promise/prefer-await-to-then\n thenable.then(\n // eslint-disable-next-line promise/always-return\n (returnValue) => {\n setIsReactActEnvironment(previousActEnvironment);\n // @ts-expect-error\n resolve(returnValue);\n },\n (error) => {\n setIsReactActEnvironment(previousActEnvironment);\n // @ts-expect-error\n reject(error);\n },\n );\n },\n };\n } else {\n setIsReactActEnvironment(previousActEnvironment);\n return actResult;\n }\n } catch (error) {\n // Can't be a `finally {}` block since we don't know if we have to immediately restore IS_REACT_ACT_ENVIRONMENT\n // or if we have to await the callback first.\n setIsReactActEnvironment(previousActEnvironment);\n throw error;\n }\n };\n}\n\n// @ts-expect-error\nconst act = withGlobalActEnvironment(reactAct) as ReactAct;\n\nexport default act;\nexport { setIsReactActEnvironment as setReactActEnvironment, getIsReactActEnvironment };\n"],"mappings":"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","ignoreList":[]}
|
package/build/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DebugOptions } from './helpers/debug
|
|
1
|
+
import { DebugOptions } from './helpers/debug';
|
|
2
2
|
/**
|
|
3
3
|
* Global configuration options for React Native Testing Library.
|
|
4
4
|
*/
|
|
@@ -10,8 +10,8 @@ export type Config = {
|
|
|
10
10
|
/** Default options for `debug` helper. */
|
|
11
11
|
defaultDebugOptions?: Partial<DebugOptions>;
|
|
12
12
|
/**
|
|
13
|
-
* Set to `
|
|
14
|
-
* Otherwise `render` will default to
|
|
13
|
+
* Set to `false` to disable concurrent rendering.
|
|
14
|
+
* Otherwise `render` will default to concurrent rendering.
|
|
15
15
|
*/
|
|
16
16
|
concurrentRoot: boolean;
|
|
17
17
|
};
|
|
@@ -45,8 +45,8 @@ export declare function getConfig(): {
|
|
|
45
45
|
/** Default options for `debug` helper. */
|
|
46
46
|
defaultDebugOptions?: Partial<DebugOptions>;
|
|
47
47
|
/**
|
|
48
|
-
* Set to `
|
|
49
|
-
* Otherwise `render` will default to
|
|
48
|
+
* Set to `false` to disable concurrent rendering.
|
|
49
|
+
* Otherwise `render` will default to concurrent rendering.
|
|
50
50
|
*/
|
|
51
51
|
concurrentRoot: boolean;
|
|
52
52
|
/** Names for key React Native host components. */
|
package/build/config.js
CHANGED
package/build/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["defaultConfig","asyncUtilTimeout","defaultIncludeHiddenElements","concurrentRoot","config","configure","options","defaultHidden","restOptions","configureInternal","option","resetToDefaults","getConfig"],"sources":["../src/config.ts"],"sourcesContent":["import { DebugOptions } from './helpers/debug
|
|
1
|
+
{"version":3,"file":"config.js","names":["defaultConfig","asyncUtilTimeout","defaultIncludeHiddenElements","concurrentRoot","config","configure","options","defaultHidden","restOptions","configureInternal","option","resetToDefaults","getConfig"],"sources":["../src/config.ts"],"sourcesContent":["import { DebugOptions } from './helpers/debug';\n\n/**\n * Global configuration options for React Native Testing Library.\n */\n\nexport type Config = {\n /** Default timeout, in ms, for `waitFor` and `findBy*` queries. */\n asyncUtilTimeout: number;\n\n /** Default value for `includeHiddenElements` query option. */\n defaultIncludeHiddenElements: boolean;\n\n /** Default options for `debug` helper. */\n defaultDebugOptions?: Partial<DebugOptions>;\n\n /**\n * Set to `false` to disable concurrent rendering.\n * Otherwise `render` will default to concurrent rendering.\n */\n concurrentRoot: boolean;\n};\n\nexport type ConfigAliasOptions = {\n /** RTL-compatibility alias to `defaultIncludeHiddenElements` */\n defaultHidden: boolean;\n};\n\nexport type HostComponentNames = {\n text: string;\n textInput: string;\n image: string;\n switch: string;\n scrollView: string;\n modal: string;\n};\n\nexport type InternalConfig = Config & {\n /** Names for key React Native host components. */\n hostComponentNames?: HostComponentNames;\n};\n\nconst defaultConfig: InternalConfig = {\n asyncUtilTimeout: 1000,\n defaultIncludeHiddenElements: false,\n concurrentRoot: true,\n};\n\nlet config = { ...defaultConfig };\n\n/**\n * Configure global options for React Native Testing Library.\n */\nexport function configure(options: Partial<Config & ConfigAliasOptions>) {\n const { defaultHidden, ...restOptions } = options;\n\n const defaultIncludeHiddenElements =\n restOptions.defaultIncludeHiddenElements ??\n defaultHidden ??\n config.defaultIncludeHiddenElements;\n\n config = {\n ...config,\n ...restOptions,\n defaultIncludeHiddenElements,\n };\n}\n\nexport function configureInternal(option: Partial<InternalConfig>) {\n config = {\n ...config,\n ...option,\n };\n}\n\nexport function resetToDefaults() {\n config = { ...defaultConfig };\n}\n\nexport function getConfig() {\n return config;\n}\n"],"mappings":";;;;;;;;;AAEA;AACA;AACA;;AAsCA,MAAMA,aAA6B,GAAG;EACpCC,gBAAgB,EAAE,IAAI;EACtBC,4BAA4B,EAAE,KAAK;EACnCC,cAAc,EAAE;AAClB,CAAC;AAED,IAAIC,MAAM,GAAG;EAAE,GAAGJ;AAAc,CAAC;;AAEjC;AACA;AACA;AACO,SAASK,SAASA,CAACC,OAA6C,EAAE;EACvE,MAAM;IAAEC,aAAa;IAAE,GAAGC;EAAY,CAAC,GAAGF,OAAO;EAEjD,MAAMJ,4BAA4B,GAChCM,WAAW,CAACN,4BAA4B,IACxCK,aAAa,IACbH,MAAM,CAACF,4BAA4B;EAErCE,MAAM,GAAG;IACP,GAAGA,MAAM;IACT,GAAGI,WAAW;IACdN;EACF,CAAC;AACH;AAEO,SAASO,iBAAiBA,CAACC,MAA+B,EAAE;EACjEN,MAAM,GAAG;IACP,GAAGA,MAAM;IACT,GAAGM;EACL,CAAC;AACH;AAEO,SAASC,eAAeA,CAAA,EAAG;EAChCP,MAAM,GAAG;IAAE,GAAGJ;EAAc,CAAC;AAC/B;AAEO,SAASY,SAASA,CAAA,EAAG;EAC1B,OAAOR,MAAM;AACf","ignoreList":[]}
|
|
@@ -1,19 +1 @@
|
|
|
1
1
|
export declare function flushMicroTasks(): Promise<unknown>;
|
|
2
|
-
/**
|
|
3
|
-
* @deprecated To be removed in the next major release.
|
|
4
|
-
*/
|
|
5
|
-
type Thenable<T> = {
|
|
6
|
-
then: (callback: () => T) => unknown;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* This legacy implementation of `flushMicroTasks` is used for compatibility with
|
|
10
|
-
* older versions of React Native (pre 0.71) which uses Promise polyfil.
|
|
11
|
-
*
|
|
12
|
-
* For users with older version of React Native there is a workaround of using our own
|
|
13
|
-
* Jest preset instead the `react-native` one, but requiring such change would be a
|
|
14
|
-
* breaking change for existing users.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated To be removed in the next major release.
|
|
17
|
-
*/
|
|
18
|
-
export declare function flushMicroTasksLegacy(): Thenable<void>;
|
|
19
|
-
export {};
|
|
@@ -4,33 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.flushMicroTasks = flushMicroTasks;
|
|
7
|
-
exports.flushMicroTasksLegacy = flushMicroTasksLegacy;
|
|
8
7
|
var _timers = require("./helpers/timers");
|
|
9
8
|
function flushMicroTasks() {
|
|
10
9
|
return new Promise(resolve => (0, _timers.setImmediate)(resolve));
|
|
11
10
|
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* @deprecated To be removed in the next major release.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* This legacy implementation of `flushMicroTasks` is used for compatibility with
|
|
19
|
-
* older versions of React Native (pre 0.71) which uses Promise polyfil.
|
|
20
|
-
*
|
|
21
|
-
* For users with older version of React Native there is a workaround of using our own
|
|
22
|
-
* Jest preset instead the `react-native` one, but requiring such change would be a
|
|
23
|
-
* breaking change for existing users.
|
|
24
|
-
*
|
|
25
|
-
* @deprecated To be removed in the next major release.
|
|
26
|
-
*/
|
|
27
|
-
function flushMicroTasksLegacy() {
|
|
28
|
-
return {
|
|
29
|
-
// using "thenable" instead of a Promise, because otherwise it breaks when
|
|
30
|
-
// using "modern" fake timers
|
|
31
|
-
then(resolve) {
|
|
32
|
-
(0, _timers.setImmediate)(resolve);
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
11
|
//# sourceMappingURL=flush-micro-tasks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flush-micro-tasks.js","names":["_timers","require","flushMicroTasks","Promise","resolve","setImmediate"
|
|
1
|
+
{"version":3,"file":"flush-micro-tasks.js","names":["_timers","require","flushMicroTasks","Promise","resolve","setImmediate"],"sources":["../src/flush-micro-tasks.ts"],"sourcesContent":["import { setImmediate } from './helpers/timers';\n\nexport function flushMicroTasks() {\n return new Promise((resolve) => setImmediate(resolve));\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEO,SAASC,eAAeA,CAAA,EAAG;EAChC,OAAO,IAAIC,OAAO,CAAEC,OAAO,IAAK,IAAAC,oBAAY,EAACD,OAAO,CAAC,CAAC;AACxD","ignoreList":[]}
|
|
@@ -6,4 +6,4 @@ export type DebugOptions = {
|
|
|
6
6
|
/**
|
|
7
7
|
* Log pretty-printed deep test component instance
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export declare function debug(instance: ReactTestRendererJSON | ReactTestRendererJSON[], options?: DebugOptions | string): void;
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.debug = debug;
|
|
7
7
|
var _format = _interopRequireDefault(require("./format"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/**
|
|
10
10
|
* Log pretty-printed deep test component instance
|
|
11
11
|
*/
|
|
12
|
-
function
|
|
12
|
+
function debug(instance, options) {
|
|
13
13
|
const message = typeof options === 'string' ? options : options?.message;
|
|
14
14
|
const formatOptions = typeof options === 'object' ? {
|
|
15
15
|
mapProps: options?.mapProps
|
|
@@ -22,4 +22,4 @@ function debugDeep(instance, options) {
|
|
|
22
22
|
console.log((0, _format.default)(instance, formatOptions));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=debug
|
|
25
|
+
//# sourceMappingURL=debug.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.js","names":["_format","_interopRequireDefault","require","e","__esModule","default","debug","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debug.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 function debug(\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;AACO,SAASG,KAAKA,CACnBC,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":[]}
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.wrapAsync = wrapAsync;
|
|
7
|
-
var _act =
|
|
7
|
+
var _act = require("../act");
|
|
8
8
|
var _flushMicroTasks = require("../flush-micro-tasks");
|
|
9
|
-
var _reactVersions = require("../react-versions");
|
|
10
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
9
|
/* istanbul ignore file */
|
|
13
10
|
|
|
14
11
|
/**
|
|
@@ -18,29 +15,15 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
18
15
|
* @returns Result of the callback
|
|
19
16
|
*/
|
|
20
17
|
async function wrapAsync(callback) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
(0, _act.setReactActEnvironment)(previousActEnvironment);
|
|
31
|
-
}
|
|
18
|
+
const previousActEnvironment = (0, _act.getIsReactActEnvironment)();
|
|
19
|
+
(0, _act.setReactActEnvironment)(false);
|
|
20
|
+
try {
|
|
21
|
+
const result = await callback();
|
|
22
|
+
// Flush the microtask queue before restoring the `act` environment
|
|
23
|
+
await (0, _flushMicroTasks.flushMicroTasks)();
|
|
24
|
+
return result;
|
|
25
|
+
} finally {
|
|
26
|
+
(0, _act.setReactActEnvironment)(previousActEnvironment);
|
|
32
27
|
}
|
|
33
|
-
if (!(0, _reactVersions.checkReactVersionAtLeast)(16, 9)) {
|
|
34
|
-
return callback();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Wrapping with act for react version 16.9 to 17.x
|
|
38
|
-
let result;
|
|
39
|
-
await (0, _act.default)(async () => {
|
|
40
|
-
result = await callback();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// Either we have result or `callback` threw error
|
|
44
|
-
return result;
|
|
45
28
|
}
|
|
46
29
|
//# sourceMappingURL=wrap-async.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap-async.js","names":["_act","
|
|
1
|
+
{"version":3,"file":"wrap-async.js","names":["_act","require","_flushMicroTasks","wrapAsync","callback","previousActEnvironment","getIsReactActEnvironment","setReactActEnvironment","result","flushMicroTasks"],"sources":["../../src/helpers/wrap-async.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport { getIsReactActEnvironment, setReactActEnvironment } from '../act';\nimport { flushMicroTasks } from '../flush-micro-tasks';\n\n/**\n * Run given async callback with temporarily disabled `act` environment and flushes microtasks queue.\n *\n * @param callback Async callback to run\n * @returns Result of the callback\n */\nexport async function wrapAsync<Result>(callback: () => Promise<Result>): Promise<Result> {\n const previousActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(false);\n\n try {\n const result = await callback();\n // Flush the microtask queue before restoring the `act` environment\n await flushMicroTasks();\n return result;\n } finally {\n setReactActEnvironment(previousActEnvironment);\n }\n}\n"],"mappings":";;;;;;AAEA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAHA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACO,eAAeE,SAASA,CAASC,QAA+B,EAAmB;EACxF,MAAMC,sBAAsB,GAAG,IAAAC,6BAAwB,EAAC,CAAC;EACzD,IAAAC,2BAAsB,EAAC,KAAK,CAAC;EAE7B,IAAI;IACF,MAAMC,MAAM,GAAG,MAAMJ,QAAQ,CAAC,CAAC;IAC/B;IACA,MAAM,IAAAK,gCAAe,EAAC,CAAC;IACvB,OAAOD,MAAM;EACf,CAAC,SAAS;IACR,IAAAD,2BAAsB,EAACF,sBAAsB,CAAC;EAChD;AACF","ignoreList":[]}
|
package/build/index.d.ts
CHANGED
package/build/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 &
|
package/build/index.js
CHANGED
|
@@ -16,6 +16,7 @@ Object.keys(_pure).forEach(function (key) {
|
|
|
16
16
|
});
|
|
17
17
|
var _flushMicroTasks = require("./flush-micro-tasks");
|
|
18
18
|
var _act = require("./act");
|
|
19
|
+
require("./matchers/extend-expect");
|
|
19
20
|
if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
|
|
20
21
|
// If we're running in a test runner that supports afterEach
|
|
21
22
|
// then we'll automatically run cleanup afterEach test
|
|
@@ -25,7 +26,7 @@ if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
|
|
|
25
26
|
if (typeof afterEach === 'function') {
|
|
26
27
|
// eslint-disable-next-line no-undef
|
|
27
28
|
afterEach(async () => {
|
|
28
|
-
await (0, _flushMicroTasks.
|
|
29
|
+
await (0, _flushMicroTasks.flushMicroTasks)();
|
|
29
30
|
(0, _pure.cleanup)();
|
|
30
31
|
});
|
|
31
32
|
}
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_pure","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_flushMicroTasks","_act","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_pure","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_flushMicroTasks","_act","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import { cleanup } from './pure';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\nimport './matchers/extend-expect';\n\nif (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {\n // If we're running in a test runner that supports afterEach\n // then we'll automatically run cleanup afterEach test\n // this ensures that tests run in isolation from each other\n // if you don't like this then either import the `pure` module\n // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.\n if (typeof afterEach === 'function') {\n // eslint-disable-next-line no-undef\n afterEach(async () => {\n await flushMicroTasks();\n cleanup();\n });\n }\n\n if (typeof beforeAll === 'function' && typeof afterAll === 'function') {\n // This matches the behavior of React < 18.\n let previousIsReactActEnvironment = getIsReactActEnvironment();\n beforeAll(() => {\n previousIsReactActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(true);\n });\n\n afterAll(() => {\n setReactActEnvironment(previousIsReactActEnvironment);\n });\n }\n}\n\nexport * from './pure';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAiCAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAhCA,IAAAK,gBAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AACAA,OAAA;AAEA,IAAI,CAACW,OAAO,EAAEC,GAAG,EAAEC,sBAAsB,EAAE;EACzC;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnC;IACAA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,EAAC,CAAC;MACvB,IAAAC,aAAO,EAAC,CAAC;IACX,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOC,SAAS,KAAK,UAAU,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IACrE;IACA,IAAIC,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;IAC9DH,SAAS,CAAC,MAAM;MACdE,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;MAC1D,IAAAC,2BAAsB,EAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEFH,QAAQ,CAAC,MAAM;MACb,IAAAG,2BAAsB,EAACF,6BAA6B,CAAC;IACvD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
package/build/render.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
/**
|
|
6
6
|
* Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
|
|
@@ -8,10 +8,10 @@ export interface RenderOptions {
|
|
|
8
8
|
*/
|
|
9
9
|
wrapper?: React.ComponentType<any>;
|
|
10
10
|
/**
|
|
11
|
-
* Set to `
|
|
12
|
-
* Otherwise `render` will default to
|
|
11
|
+
* Set to `false` to disable concurrent rendering.
|
|
12
|
+
* Otherwise `render` will default to concurrent rendering.
|
|
13
13
|
*/
|
|
14
|
-
concurrentRoot?: boolean
|
|
14
|
+
concurrentRoot?: boolean;
|
|
15
15
|
createNodeMock?: (element: React.ReactElement) => unknown;
|
|
16
16
|
unstable_validateStringsRenderedWithinText?: boolean;
|
|
17
17
|
}
|
|
@@ -44,30 +44,6 @@ export default function render<T>(component: React.ReactElement<T>, options?: Re
|
|
|
44
44
|
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
45
45
|
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
46
46
|
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
47
|
-
getByA11yValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
48
|
-
getAllByA11yValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
49
|
-
queryByA11yValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
50
|
-
queryAllByA11yValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
51
|
-
findByA11yValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
52
|
-
findAllByA11yValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
53
|
-
getByAccessibilityValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
54
|
-
getAllByAccessibilityValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
55
|
-
queryByAccessibilityValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
56
|
-
queryAllByAccessibilityValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
57
|
-
findByAccessibilityValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
58
|
-
findAllByAccessibilityValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
59
|
-
getByA11yState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
60
|
-
getAllByA11yState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
61
|
-
queryByA11yState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
62
|
-
queryAllByA11yState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
63
|
-
findByA11yState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
64
|
-
findAllByA11yState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
65
|
-
getByAccessibilityState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
66
|
-
getAllByAccessibilityState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
67
|
-
queryByAccessibilityState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
68
|
-
queryAllByAccessibilityState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
69
|
-
findByAccessibilityState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
70
|
-
findAllByAccessibilityState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
71
47
|
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
72
48
|
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
73
49
|
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
@@ -150,30 +126,6 @@ export declare function renderInternal<T>(component: React.ReactElement<T>, opti
|
|
|
150
126
|
UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
151
127
|
UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
|
|
152
128
|
UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
|
|
153
|
-
getByA11yValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
154
|
-
getAllByA11yValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
155
|
-
queryByA11yValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
156
|
-
queryAllByA11yValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
157
|
-
findByA11yValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
158
|
-
findAllByA11yValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
159
|
-
getByAccessibilityValue: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
160
|
-
getAllByAccessibilityValue: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
161
|
-
queryByAccessibilityValue: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
162
|
-
queryAllByAccessibilityValue: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
163
|
-
findByAccessibilityValue: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
164
|
-
findAllByAccessibilityValue: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-value").AccessibilityValueMatcher, import("./queries/options").CommonQueryOptions>;
|
|
165
|
-
getByA11yState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
166
|
-
getAllByA11yState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
167
|
-
queryByA11yState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
168
|
-
queryAllByA11yState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
169
|
-
findByA11yState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
170
|
-
findAllByA11yState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
171
|
-
getByAccessibilityState: import("./queries/make-queries").GetByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
172
|
-
getAllByAccessibilityState: import("./queries/make-queries").GetAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
173
|
-
queryByAccessibilityState: import("./queries/make-queries").QueryByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
174
|
-
queryAllByAccessibilityState: import("./queries/make-queries").QueryAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
175
|
-
findByAccessibilityState: import("./queries/make-queries").FindByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
176
|
-
findAllByAccessibilityState: import("./queries/make-queries").FindAllByQuery<import("./helpers/matchers/match-accessibility-state").AccessibilityStateMatcher, import("./queries/options").CommonQueryOptions>;
|
|
177
129
|
getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
178
130
|
getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
179
131
|
queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
|
|
@@ -229,7 +181,4 @@ export declare function renderInternal<T>(component: React.ReactElement<T>, opti
|
|
|
229
181
|
findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
230
182
|
findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
|
|
231
183
|
};
|
|
232
|
-
export
|
|
233
|
-
(options?: DebugOptions | string): void;
|
|
234
|
-
shallow: (message?: string) => void;
|
|
235
|
-
}
|
|
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");
|
|
@@ -89,7 +88,7 @@ function buildRenderResult(renderer, wrap) {
|
|
|
89
88
|
rerender: update,
|
|
90
89
|
// alias for `update`
|
|
91
90
|
toJSON: renderer.toJSON,
|
|
92
|
-
debug:
|
|
91
|
+
debug: makeDebug(instance, renderer),
|
|
93
92
|
get root() {
|
|
94
93
|
return (0, _componentTree.getHostChildren)(instance)[0];
|
|
95
94
|
},
|
|
@@ -114,7 +113,7 @@ function updateWithAct(renderer, wrap) {
|
|
|
114
113
|
});
|
|
115
114
|
};
|
|
116
115
|
}
|
|
117
|
-
function
|
|
116
|
+
function makeDebug(instance, renderer) {
|
|
118
117
|
function debugImpl(options) {
|
|
119
118
|
const {
|
|
120
119
|
defaultDebugOptions
|
|
@@ -128,14 +127,13 @@ function debug(instance, renderer) {
|
|
|
128
127
|
};
|
|
129
128
|
if (typeof options === 'string') {
|
|
130
129
|
// eslint-disable-next-line no-console
|
|
131
|
-
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.');
|
|
132
131
|
}
|
|
133
132
|
const json = renderer.toJSON();
|
|
134
133
|
if (json) {
|
|
135
|
-
return (0,
|
|
134
|
+
return (0, _debug.debug)(json, debugOptions);
|
|
136
135
|
}
|
|
137
136
|
}
|
|
138
|
-
debugImpl.shallow = message => (0, _debugShallow.default)(instance, message);
|
|
139
137
|
return debugImpl;
|
|
140
138
|
}
|
|
141
139
|
//# sourceMappingURL=render.js.map
|