@testing-library/react-native 11.4.0 → 11.5.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 +3 -3
- package/build/cleanup.d.ts +1 -1
- package/build/config.d.ts +10 -2
- package/build/config.js +12 -3
- package/build/config.js.map +1 -1
- package/build/flushMicroTasks.d.ts +1 -1
- package/build/helpers/accessiblity.d.ts +10 -4
- package/build/helpers/accessiblity.js +19 -9
- package/build/helpers/accessiblity.js.map +1 -1
- package/build/helpers/debugDeep.d.ts +1 -1
- package/build/helpers/findAll.d.ts +10 -0
- package/build/helpers/findAll.js +44 -0
- package/build/helpers/findAll.js.map +1 -0
- package/build/helpers/format.d.ts +2 -2
- package/build/helpers/getTextContent.d.ts +2 -0
- package/build/helpers/getTextContent.js +20 -0
- package/build/helpers/getTextContent.js.map +1 -0
- package/build/helpers/matchers/accessibilityValue.d.ts +9 -0
- package/build/helpers/matchers/accessibilityValue.js +12 -0
- package/build/helpers/matchers/accessibilityValue.js.map +1 -0
- package/build/helpers/matchers/matchTextContent.d.ts +3 -0
- package/build/helpers/matchers/matchTextContent.js +22 -0
- package/build/helpers/matchers/matchTextContent.js.map +1 -0
- package/build/helpers/timers.js.map +1 -1
- package/build/index.flow.js +122 -54
- package/build/matches.d.ts +7 -3
- package/build/matches.js.map +1 -1
- package/build/pure.d.ts +12 -23
- package/build/pure.js +8 -2
- package/build/pure.js.map +1 -1
- package/build/queries/a11yState.d.ts +15 -14
- package/build/queries/a11yState.js +3 -2
- package/build/queries/a11yState.js.map +1 -1
- package/build/queries/a11yValue.d.ts +15 -20
- package/build/queries/a11yValue.js +16 -5
- package/build/queries/a11yValue.js.map +1 -1
- package/build/queries/displayValue.d.ts +11 -9
- package/build/queries/displayValue.js +2 -1
- package/build/queries/displayValue.js.map +1 -1
- package/build/queries/hintText.d.ts +23 -21
- package/build/queries/hintText.js +2 -1
- package/build/queries/hintText.js.map +1 -1
- package/build/queries/labelText.d.ts +11 -9
- package/build/queries/labelText.js +2 -1
- package/build/queries/labelText.js.map +1 -1
- package/build/queries/makeQueries.d.ts +8 -8
- package/build/queries/options.d.ts +11 -0
- package/build/queries/options.js +2 -0
- package/build/queries/options.js.map +1 -0
- package/build/queries/placeholderText.d.ts +11 -9
- package/build/queries/placeholderText.js +2 -1
- package/build/queries/placeholderText.js.map +1 -1
- package/build/queries/role.d.ts +7 -4
- package/build/queries/role.js +19 -10
- package/build/queries/role.js.map +1 -1
- package/build/queries/testId.d.ts +11 -9
- package/build/queries/testId.js +3 -2
- package/build/queries/testId.js.map +1 -1
- package/build/queries/text.d.ts +11 -13
- package/build/queries/text.js +6 -47
- package/build/queries/text.js.map +1 -1
- package/build/queries/unsafeProps.d.ts +1 -1
- package/build/queries/unsafeType.d.ts +1 -1
- package/build/render.d.ts +92 -146
- package/build/renderHook.d.ts +2 -2
- package/build/waitFor.d.ts +1 -1
- package/build/within.d.ts +90 -144
- package/package.json +8 -8
- package/typings/index.flow.js +122 -54
package/README.md
CHANGED
|
@@ -117,8 +117,8 @@ test('form submits two answers', () => {
|
|
|
117
117
|
fireEvent.press(screen.getByText('Submit'));
|
|
118
118
|
|
|
119
119
|
expect(mockFn).toBeCalledWith({
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
1: { q: 'q1', a: 'a1' },
|
|
121
|
+
2: { q: 'q2', a: 'a2' },
|
|
122
122
|
});
|
|
123
123
|
});
|
|
124
124
|
```
|
|
@@ -173,4 +173,4 @@ Supported and used by [Rally Health](https://www.rallyhealth.com/careers-home).
|
|
|
173
173
|
[callstack-badge]: https://callstack.com/images/callstack-badge.svg
|
|
174
174
|
[callstack]: https://callstack.com/open-source/?utm_source=github.com&utm_medium=referral&utm_campaign=react-native-testing-library&utm_term=readme
|
|
175
175
|
[codecov-badge]: https://codecov.io/gh/callstack/react-native-testing-library/branch/main/graph/badge.svg?token=tYVSWro1IP
|
|
176
|
-
[codecov]: https://codecov.io/gh/callstack/react-native-testing-library
|
|
176
|
+
[codecov]: https://codecov.io/gh/callstack/react-native-testing-library
|
package/build/cleanup.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
type CleanUpFunction = (nextElement?: React.ReactElement<any>) => void;
|
|
3
3
|
export default function cleanup(): void;
|
|
4
4
|
export declare function addToCleanupQueue(fn: CleanUpFunction): void;
|
|
5
5
|
export {};
|
package/build/config.d.ts
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { DebugOptions } from './helpers/debugDeep';
|
|
2
|
-
export
|
|
2
|
+
export type Config = {
|
|
3
3
|
/** Default timeout, in ms, for `waitFor` and `findBy*` queries. */
|
|
4
4
|
asyncUtilTimeout: number;
|
|
5
|
+
/** Default value for `includeHiddenElements` query option. */
|
|
6
|
+
defaultIncludeHiddenElements: boolean;
|
|
5
7
|
/** Default options for `debug` helper. */
|
|
6
8
|
defaultDebugOptions?: Partial<DebugOptions>;
|
|
7
9
|
};
|
|
8
|
-
export
|
|
10
|
+
export type ConfigAliasOptions = {
|
|
11
|
+
/** RTL-compatibility alias to `defaultIncludeHiddenElements` */
|
|
12
|
+
defaultHidden: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare function configure(options: Partial<Config & ConfigAliasOptions>): void;
|
|
9
15
|
export declare function resetToDefaults(): void;
|
|
10
16
|
export declare function getConfig(): {
|
|
11
17
|
/** Default timeout, in ms, for `waitFor` and `findBy*` queries. */
|
|
12
18
|
asyncUtilTimeout: number;
|
|
19
|
+
/** Default value for `includeHiddenElements` query option. */
|
|
20
|
+
defaultIncludeHiddenElements: boolean;
|
|
13
21
|
/** Default options for `debug` helper. */
|
|
14
22
|
defaultDebugOptions?: Partial<DebugOptions> | undefined;
|
|
15
23
|
};
|
package/build/config.js
CHANGED
|
@@ -7,19 +7,28 @@ exports.configure = configure;
|
|
|
7
7
|
exports.getConfig = getConfig;
|
|
8
8
|
exports.resetToDefaults = resetToDefaults;
|
|
9
9
|
const defaultConfig = {
|
|
10
|
-
asyncUtilTimeout: 1000
|
|
10
|
+
asyncUtilTimeout: 1000,
|
|
11
|
+
defaultIncludeHiddenElements: true
|
|
11
12
|
};
|
|
12
13
|
let config = {
|
|
13
14
|
...defaultConfig
|
|
14
15
|
};
|
|
15
16
|
function configure(options) {
|
|
17
|
+
const {
|
|
18
|
+
defaultHidden,
|
|
19
|
+
...restOptions
|
|
20
|
+
} = options;
|
|
21
|
+
const defaultIncludeHiddenElements = restOptions.defaultIncludeHiddenElements ?? defaultHidden ?? config.defaultIncludeHiddenElements;
|
|
16
22
|
config = {
|
|
17
23
|
...config,
|
|
18
|
-
...
|
|
24
|
+
...restOptions,
|
|
25
|
+
defaultIncludeHiddenElements
|
|
19
26
|
};
|
|
20
27
|
}
|
|
21
28
|
function resetToDefaults() {
|
|
22
|
-
config =
|
|
29
|
+
config = {
|
|
30
|
+
...defaultConfig
|
|
31
|
+
};
|
|
23
32
|
}
|
|
24
33
|
function getConfig() {
|
|
25
34
|
return config;
|
package/build/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["defaultConfig","asyncUtilTimeout","config","configure","options","resetToDefaults","getConfig"],"sources":["../src/config.ts"],"sourcesContent":["import { DebugOptions } from './helpers/debugDeep';\n\nexport type Config = {\n /** Default timeout, in ms, for `waitFor` and `findBy*` queries. */\n asyncUtilTimeout: number;\n\n /** Default options for `debug` helper. */\n defaultDebugOptions?: Partial<DebugOptions>;\n};\n\nconst defaultConfig: Config = {\n asyncUtilTimeout: 1000,\n};\n\nlet config = {
|
|
1
|
+
{"version":3,"file":"config.js","names":["defaultConfig","asyncUtilTimeout","defaultIncludeHiddenElements","config","configure","options","defaultHidden","restOptions","resetToDefaults","getConfig"],"sources":["../src/config.ts"],"sourcesContent":["import { DebugOptions } from './helpers/debugDeep';\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\nexport type ConfigAliasOptions = {\n /** RTL-compatibility alias to `defaultIncludeHiddenElements` */\n defaultHidden: boolean;\n};\n\nconst defaultConfig: Config = {\n asyncUtilTimeout: 1000,\n defaultIncludeHiddenElements: true,\n};\n\nlet config = { ...defaultConfig };\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 resetToDefaults() {\n config = { ...defaultConfig };\n}\n\nexport function getConfig() {\n return config;\n}\n"],"mappings":";;;;;;;;AAkBA,MAAMA,aAAqB,GAAG;EAC5BC,gBAAgB,EAAE,IAAI;EACtBC,4BAA4B,EAAE;AAChC,CAAC;AAED,IAAIC,MAAM,GAAG;EAAE,GAAGH;AAAc,CAAC;AAE1B,SAASI,SAAS,CAACC,OAA6C,EAAE;EACvE,MAAM;IAAEC,aAAa;IAAE,GAAGC;EAAY,CAAC,GAAGF,OAAO;EAEjD,MAAMH,4BAA4B,GAChCK,WAAW,CAACL,4BAA4B,IACxCI,aAAa,IACbH,MAAM,CAACD,4BAA4B;EAErCC,MAAM,GAAG;IACP,GAAGA,MAAM;IACT,GAAGI,WAAW;IACdL;EACF,CAAC;AACH;AAEO,SAASM,eAAe,GAAG;EAChCL,MAAM,GAAG;IAAE,GAAGH;EAAc,CAAC;AAC/B;AAEO,SAASS,SAAS,GAAG;EAC1B,OAAON,MAAM;AACf"}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import { AccessibilityState } from 'react-native';
|
|
1
|
+
import { AccessibilityState, AccessibilityValue } from 'react-native';
|
|
2
2
|
import { ReactTestInstance } from 'react-test-renderer';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
type IsInaccessibleOptions = {
|
|
4
|
+
cache?: WeakMap<ReactTestInstance, boolean>;
|
|
5
|
+
};
|
|
6
|
+
export declare const accessibilityStateKeys: (keyof AccessibilityState)[];
|
|
7
|
+
export declare const accessiblityValueKeys: (keyof AccessibilityValue)[];
|
|
8
|
+
export declare function isHiddenFromAccessibility(element: ReactTestInstance | null, { cache }?: IsInaccessibleOptions): boolean;
|
|
9
|
+
/** RTL-compatitibility alias for `isHiddenFromAccessibility` */
|
|
10
|
+
export declare const isInaccessible: typeof isHiddenFromAccessibility;
|
|
11
|
+
export {};
|
|
@@ -3,30 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.accessibilityStateKeys = void 0;
|
|
7
|
-
exports.
|
|
6
|
+
exports.accessiblityValueKeys = exports.accessibilityStateKeys = void 0;
|
|
7
|
+
exports.isHiddenFromAccessibility = isHiddenFromAccessibility;
|
|
8
|
+
exports.isInaccessible = void 0;
|
|
8
9
|
var _reactNative = require("react-native");
|
|
9
10
|
var _componentTree = require("./component-tree");
|
|
10
11
|
const accessibilityStateKeys = ['disabled', 'selected', 'checked', 'busy', 'expanded'];
|
|
11
12
|
exports.accessibilityStateKeys = accessibilityStateKeys;
|
|
12
|
-
|
|
13
|
+
const accessiblityValueKeys = ['min', 'max', 'now', 'text'];
|
|
14
|
+
exports.accessiblityValueKeys = accessiblityValueKeys;
|
|
15
|
+
function isHiddenFromAccessibility(element, {
|
|
16
|
+
cache
|
|
17
|
+
} = {}) {
|
|
13
18
|
if (element == null) {
|
|
14
19
|
return true;
|
|
15
20
|
}
|
|
16
21
|
let current = element;
|
|
17
22
|
while (current) {
|
|
18
|
-
|
|
23
|
+
let isCurrentSubtreeInaccessible = cache?.get(current);
|
|
24
|
+
if (isCurrentSubtreeInaccessible === undefined) {
|
|
25
|
+
isCurrentSubtreeInaccessible = isSubtreeInaccessible(current);
|
|
26
|
+
cache?.set(current, isCurrentSubtreeInaccessible);
|
|
27
|
+
}
|
|
28
|
+
if (isCurrentSubtreeInaccessible) {
|
|
19
29
|
return true;
|
|
20
30
|
}
|
|
21
31
|
current = current.parent;
|
|
22
32
|
}
|
|
23
33
|
return false;
|
|
24
34
|
}
|
|
25
|
-
function isSubtreeInaccessible(element) {
|
|
26
|
-
if (element == null) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
35
|
|
|
36
|
+
/** RTL-compatitibility alias for `isHiddenFromAccessibility` */
|
|
37
|
+
const isInaccessible = isHiddenFromAccessibility;
|
|
38
|
+
exports.isInaccessible = isInaccessible;
|
|
39
|
+
function isSubtreeInaccessible(element) {
|
|
30
40
|
// iOS: accessibilityElementsHidden
|
|
31
41
|
// See: https://reactnative.dev/docs/accessibility#accessibilityelementshidden-ios
|
|
32
42
|
if (element.props.accessibilityElementsHidden) {
|
|
@@ -39,7 +49,7 @@ function isSubtreeInaccessible(element) {
|
|
|
39
49
|
return true;
|
|
40
50
|
}
|
|
41
51
|
|
|
42
|
-
// Note that `opacity: 0` is not
|
|
52
|
+
// Note that `opacity: 0` is not treated as inaccessible on iOS
|
|
43
53
|
const flatStyle = _reactNative.StyleSheet.flatten(element.props.style) ?? {};
|
|
44
54
|
if (flatStyle.display === 'none') return true;
|
|
45
55
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accessiblity.js","names":["accessibilityStateKeys","
|
|
1
|
+
{"version":3,"file":"accessiblity.js","names":["accessibilityStateKeys","accessiblityValueKeys","isHiddenFromAccessibility","element","cache","current","isCurrentSubtreeInaccessible","get","undefined","isSubtreeInaccessible","set","parent","isInaccessible","props","accessibilityElementsHidden","importantForAccessibility","flatStyle","StyleSheet","flatten","style","display","hostSiblings","getHostSiblings","some","sibling","accessibilityViewIsModal"],"sources":["../../src/helpers/accessiblity.ts"],"sourcesContent":["import {\n AccessibilityState,\n AccessibilityValue,\n StyleSheet,\n} from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { getHostSiblings } from './component-tree';\n\ntype IsInaccessibleOptions = {\n cache?: WeakMap<ReactTestInstance, boolean>;\n};\n\nexport const accessibilityStateKeys: (keyof AccessibilityState)[] = [\n 'disabled',\n 'selected',\n 'checked',\n 'busy',\n 'expanded',\n];\n\nexport const accessiblityValueKeys: (keyof AccessibilityValue)[] = [\n 'min',\n 'max',\n 'now',\n 'text',\n];\n\nexport function isHiddenFromAccessibility(\n element: ReactTestInstance | null,\n { cache }: IsInaccessibleOptions = {}\n): boolean {\n if (element == null) {\n return true;\n }\n\n let current: ReactTestInstance | null = element;\n while (current) {\n let isCurrentSubtreeInaccessible = cache?.get(current);\n\n if (isCurrentSubtreeInaccessible === undefined) {\n isCurrentSubtreeInaccessible = isSubtreeInaccessible(current);\n cache?.set(current, isCurrentSubtreeInaccessible);\n }\n\n if (isCurrentSubtreeInaccessible) {\n return true;\n }\n\n current = current.parent;\n }\n\n return false;\n}\n\n/** RTL-compatitibility alias for `isHiddenFromAccessibility` */\nexport const isInaccessible = isHiddenFromAccessibility;\n\nfunction isSubtreeInaccessible(element: ReactTestInstance): boolean {\n // iOS: accessibilityElementsHidden\n // See: https://reactnative.dev/docs/accessibility#accessibilityelementshidden-ios\n if (element.props.accessibilityElementsHidden) {\n return true;\n }\n\n // Android: importantForAccessibility\n // See: https://reactnative.dev/docs/accessibility#importantforaccessibility-android\n if (element.props.importantForAccessibility === 'no-hide-descendants') {\n return true;\n }\n\n // Note that `opacity: 0` is not treated as inaccessible on iOS\n const flatStyle = StyleSheet.flatten(element.props.style) ?? {};\n if (flatStyle.display === 'none') return true;\n\n // iOS: accessibilityViewIsModal\n // See: https://reactnative.dev/docs/accessibility#accessibilityviewismodal-ios\n const hostSiblings = getHostSiblings(element);\n if (hostSiblings.some((sibling) => sibling.props.accessibilityViewIsModal)) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;AAAA;AAMA;AAMO,MAAMA,sBAAoD,GAAG,CAClE,UAAU,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACN,UAAU,CACX;AAAC;AAEK,MAAMC,qBAAmD,GAAG,CACjE,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,CACP;AAAC;AAEK,SAASC,yBAAyB,CACvCC,OAAiC,EACjC;EAAEC;AAA6B,CAAC,GAAG,CAAC,CAAC,EAC5B;EACT,IAAID,OAAO,IAAI,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,IAAIE,OAAiC,GAAGF,OAAO;EAC/C,OAAOE,OAAO,EAAE;IACd,IAAIC,4BAA4B,GAAGF,KAAK,EAAEG,GAAG,CAACF,OAAO,CAAC;IAEtD,IAAIC,4BAA4B,KAAKE,SAAS,EAAE;MAC9CF,4BAA4B,GAAGG,qBAAqB,CAACJ,OAAO,CAAC;MAC7DD,KAAK,EAAEM,GAAG,CAACL,OAAO,EAAEC,4BAA4B,CAAC;IACnD;IAEA,IAAIA,4BAA4B,EAAE;MAChC,OAAO,IAAI;IACb;IAEAD,OAAO,GAAGA,OAAO,CAACM,MAAM;EAC1B;EAEA,OAAO,KAAK;AACd;;AAEA;AACO,MAAMC,cAAc,GAAGV,yBAAyB;AAAC;AAExD,SAASO,qBAAqB,CAACN,OAA0B,EAAW;EAClE;EACA;EACA,IAAIA,OAAO,CAACU,KAAK,CAACC,2BAA2B,EAAE;IAC7C,OAAO,IAAI;EACb;;EAEA;EACA;EACA,IAAIX,OAAO,CAACU,KAAK,CAACE,yBAAyB,KAAK,qBAAqB,EAAE;IACrE,OAAO,IAAI;EACb;;EAEA;EACA,MAAMC,SAAS,GAAGC,uBAAU,CAACC,OAAO,CAACf,OAAO,CAACU,KAAK,CAACM,KAAK,CAAC,IAAI,CAAC,CAAC;EAC/D,IAAIH,SAAS,CAACI,OAAO,KAAK,MAAM,EAAE,OAAO,IAAI;;EAE7C;EACA;EACA,MAAMC,YAAY,GAAG,IAAAC,8BAAe,EAACnB,OAAO,CAAC;EAC7C,IAAIkB,YAAY,CAACE,IAAI,CAAEC,OAAO,IAAKA,OAAO,CAACX,KAAK,CAACY,wBAAwB,CAAC,EAAE;IAC1E,OAAO,IAAI;EACb;EAEA,OAAO,KAAK;AACd"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactTestInstance } from 'react-test-renderer';
|
|
2
|
+
interface FindAllOptions {
|
|
3
|
+
/** Match elements hidden from accessibility */
|
|
4
|
+
includeHiddenElements?: boolean;
|
|
5
|
+
/** RTL-compatible alias to `includeHiddenElements` */
|
|
6
|
+
hidden?: boolean;
|
|
7
|
+
matchDeepestOnly?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function findAll(root: ReactTestInstance, predicate: (element: ReactTestInstance) => boolean, options?: FindAllOptions): ReactTestInstance[];
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.findAll = findAll;
|
|
7
|
+
var _config = require("../config");
|
|
8
|
+
var _accessiblity = require("./accessiblity");
|
|
9
|
+
function findAll(root, predicate, options) {
|
|
10
|
+
const results = findAllInternal(root, predicate, options);
|
|
11
|
+
const includeHiddenElements = options?.includeHiddenElements ?? options?.hidden ?? (0, _config.getConfig)()?.defaultIncludeHiddenElements;
|
|
12
|
+
if (includeHiddenElements) {
|
|
13
|
+
return results;
|
|
14
|
+
}
|
|
15
|
+
const cache = new WeakMap();
|
|
16
|
+
return results.filter(element => !(0, _accessiblity.isHiddenFromAccessibility)(element, {
|
|
17
|
+
cache
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Extracted from React Test Renderer
|
|
22
|
+
// src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402
|
|
23
|
+
function findAllInternal(root, predicate, options) {
|
|
24
|
+
const results = [];
|
|
25
|
+
|
|
26
|
+
// Match descendants first but do not add them to results yet.
|
|
27
|
+
const matchingDescendants = [];
|
|
28
|
+
root.children.forEach(child => {
|
|
29
|
+
if (typeof child === 'string') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
matchingDescendants.push(...findAllInternal(child, predicate, options));
|
|
33
|
+
});
|
|
34
|
+
if (
|
|
35
|
+
// When matchDeepestOnly = true: add current element only if no descendants match
|
|
36
|
+
(!options?.matchDeepestOnly || matchingDescendants.length === 0) && predicate(root)) {
|
|
37
|
+
results.push(root);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Add matching descendants after element to preserve original tree walk order.
|
|
41
|
+
results.push(...matchingDescendants);
|
|
42
|
+
return results;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=findAll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findAll.js","names":["findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length"],"sources":["../../src/helpers/findAll.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessiblity';\n\ninterface FindAllOptions {\n /** Match elements hidden from accessibility */\n includeHiddenElements?: boolean;\n\n /** RTL-compatible alias to `includeHiddenElements` */\n hidden?: boolean;\n\n /* Exclude any ancestors of deepest matched elements even if they match the predicate */\n matchDeepestOnly?: boolean;\n}\n\nexport function findAll(\n root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n) {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ??\n options?.hidden ??\n getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<ReactTestInstance>();\n return results.filter(\n (element) => !isHiddenFromAccessibility(element, { cache })\n );\n}\n\n// Extracted from React Test Renderer\n// src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402\nfunction findAllInternal(\n root: ReactTestInstance,\n predicate: (element: ReactTestInstance) => boolean,\n options?: FindAllOptions\n): Array<ReactTestInstance> {\n const results: ReactTestInstance[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: ReactTestInstance[] = [];\n root.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n predicate(root)\n ) {\n results.push(root);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n"],"mappings":";;;;;;AACA;AACA;AAaO,SAASA,OAAO,CACrBC,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACxB;EACA,MAAMC,OAAO,GAAGC,eAAe,CAACJ,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;EAEzD,MAAMG,qBAAqB,GACzBH,OAAO,EAAEG,qBAAqB,IAC9BH,OAAO,EAAEI,MAAM,IACf,IAAAC,iBAAS,GAAE,EAAEC,4BAA4B;EAE3C,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,EAAqB;EAC9C,OAAOP,OAAO,CAACQ,MAAM,CAClBC,OAAO,IAAK,CAAC,IAAAC,uCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAAC,CAC5D;AACH;;AAEA;AACA;AACA,SAASL,eAAe,CACtBJ,IAAuB,EACvBC,SAAkD,EAClDC,OAAwB,EACE;EAC1B,MAAMC,OAA4B,GAAG,EAAE;;EAEvC;EACA,MAAMW,mBAAwC,GAAG,EAAE;EACnDd,IAAI,CAACe,QAAQ,CAACC,OAAO,CAAEC,KAAK,IAAK;IAC/B,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MAC7B;IACF;IACAH,mBAAmB,CAACI,IAAI,CAAC,GAAGd,eAAe,CAACa,KAAK,EAAEhB,SAAS,EAAEC,OAAO,CAAC,CAAC;EACzE,CAAC,CAAC;EAEF;EACE;EACA,CAAC,CAACA,OAAO,EAAEiB,gBAAgB,IAAIL,mBAAmB,CAACM,MAAM,KAAK,CAAC,KAC/DnB,SAAS,CAACD,IAAI,CAAC,EACf;IACAG,OAAO,CAACe,IAAI,CAAClB,IAAI,CAAC;EACpB;;EAEA;EACAG,OAAO,CAACe,IAAI,CAAC,GAAGJ,mBAAmB,CAAC;EAEpC,OAAOX,OAAO;AAChB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ReactTestRendererJSON } from 'react-test-renderer';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
type MapPropsFunction = (props: Record<string, unknown>, node: ReactTestRendererJSON) => Record<string, unknown>;
|
|
3
|
+
export type FormatOptions = {
|
|
4
4
|
mapProps?: MapPropsFunction;
|
|
5
5
|
};
|
|
6
6
|
declare const format: (input: ReactTestRendererJSON | ReactTestRendererJSON[], options?: FormatOptions) => string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTextContent = getTextContent;
|
|
7
|
+
function getTextContent(element) {
|
|
8
|
+
if (!element) {
|
|
9
|
+
return '';
|
|
10
|
+
}
|
|
11
|
+
if (typeof element === 'string') {
|
|
12
|
+
return element;
|
|
13
|
+
}
|
|
14
|
+
const result = [];
|
|
15
|
+
element.children?.forEach(child => {
|
|
16
|
+
result.push(getTextContent(child));
|
|
17
|
+
});
|
|
18
|
+
return result.join('');
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=getTextContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTextContent.js","names":["getTextContent","element","result","children","forEach","child","push","join"],"sources":["../../src/helpers/getTextContent.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\n\nexport function getTextContent(\n element: ReactTestInstance | string | null\n): string {\n if (!element) {\n return '';\n }\n\n if (typeof element === 'string') {\n return element;\n }\n\n const result: string[] = [];\n element.children?.forEach((child) => {\n result.push(getTextContent(child));\n });\n\n return result.join('');\n}\n"],"mappings":";;;;;;AAEO,SAASA,cAAc,CAC5BC,OAA0C,EAClC;EACR,IAAI,CAACA,OAAO,EAAE;IACZ,OAAO,EAAE;EACX;EAEA,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAOA,OAAO;EAChB;EAEA,MAAMC,MAAgB,GAAG,EAAE;EAC3BD,OAAO,CAACE,QAAQ,EAAEC,OAAO,CAAEC,KAAK,IAAK;IACnCH,MAAM,CAACI,IAAI,CAACN,cAAc,CAACK,KAAK,CAAC,CAAC;EACpC,CAAC,CAAC;EAEF,OAAOH,MAAM,CAACK,IAAI,CAAC,EAAE,CAAC;AACxB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactTestInstance } from 'react-test-renderer';
|
|
2
|
+
import { TextMatch } from '../../matches';
|
|
3
|
+
export interface AccessibilityValueMatcher {
|
|
4
|
+
min?: number;
|
|
5
|
+
max?: number;
|
|
6
|
+
now?: number;
|
|
7
|
+
text?: TextMatch;
|
|
8
|
+
}
|
|
9
|
+
export declare function matchAccessibilityValue(node: ReactTestInstance, matcher: AccessibilityValueMatcher): boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.matchAccessibilityValue = matchAccessibilityValue;
|
|
7
|
+
var _matchStringProp = require("./matchStringProp");
|
|
8
|
+
function matchAccessibilityValue(node, matcher) {
|
|
9
|
+
const value = node.props.accessibilityValue ?? {};
|
|
10
|
+
return (matcher.min === undefined || matcher.min === value.min) && (matcher.max === undefined || matcher.max === value.max) && (matcher.now === undefined || matcher.now === value.now) && (matcher.text === undefined || (0, _matchStringProp.matchStringProp)(value.text, matcher.text));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=accessibilityValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accessibilityValue.js","names":["matchAccessibilityValue","node","matcher","value","props","accessibilityValue","min","undefined","max","now","text","matchStringProp"],"sources":["../../../src/helpers/matchers/accessibilityValue.ts"],"sourcesContent":["import { AccessibilityValue } from 'react-native';\nimport { ReactTestInstance } from 'react-test-renderer';\nimport { TextMatch } from '../../matches';\nimport { matchStringProp } from './matchStringProp';\n\nexport interface AccessibilityValueMatcher {\n min?: number;\n max?: number;\n now?: number;\n text?: TextMatch;\n}\n\nexport function matchAccessibilityValue(\n node: ReactTestInstance,\n matcher: AccessibilityValueMatcher\n): boolean {\n const value: AccessibilityValue = node.props.accessibilityValue ?? {};\n return (\n (matcher.min === undefined || matcher.min === value.min) &&\n (matcher.max === undefined || matcher.max === value.max) &&\n (matcher.now === undefined || matcher.now === value.now) &&\n (matcher.text === undefined || matchStringProp(value.text, matcher.text))\n );\n}\n"],"mappings":";;;;;;AAGA;AASO,SAASA,uBAAuB,CACrCC,IAAuB,EACvBC,OAAkC,EACzB;EACT,MAAMC,KAAyB,GAAGF,IAAI,CAACG,KAAK,CAACC,kBAAkB,IAAI,CAAC,CAAC;EACrE,OACE,CAACH,OAAO,CAACI,GAAG,KAAKC,SAAS,IAAIL,OAAO,CAACI,GAAG,KAAKH,KAAK,CAACG,GAAG,MACtDJ,OAAO,CAACM,GAAG,KAAKD,SAAS,IAAIL,OAAO,CAACM,GAAG,KAAKL,KAAK,CAACK,GAAG,CAAC,KACvDN,OAAO,CAACO,GAAG,KAAKF,SAAS,IAAIL,OAAO,CAACO,GAAG,KAAKN,KAAK,CAACM,GAAG,CAAC,KACvDP,OAAO,CAACQ,IAAI,KAAKH,SAAS,IAAI,IAAAI,gCAAe,EAACR,KAAK,CAACO,IAAI,EAAER,OAAO,CAACQ,IAAI,CAAC,CAAC;AAE7E"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.matchTextContent = matchTextContent;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _matches = require("../../matches");
|
|
9
|
+
var _filterNodeByType = require("../filterNodeByType");
|
|
10
|
+
var _getTextContent = require("../getTextContent");
|
|
11
|
+
function matchTextContent(node, text, options = {}) {
|
|
12
|
+
if (!(0, _filterNodeByType.filterNodeByType)(node, _reactNative.Text)) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
const textContent = (0, _getTextContent.getTextContent)(node);
|
|
16
|
+
const {
|
|
17
|
+
exact,
|
|
18
|
+
normalizer
|
|
19
|
+
} = options;
|
|
20
|
+
return (0, _matches.matches)(text, textContent, normalizer, exact);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=matchTextContent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matchTextContent.js","names":["matchTextContent","node","text","options","filterNodeByType","Text","textContent","getTextContent","exact","normalizer","matches"],"sources":["../../../src/helpers/matchers/matchTextContent.ts"],"sourcesContent":["import { Text } from 'react-native';\nimport type { ReactTestInstance } from 'react-test-renderer';\nimport { matches, TextMatch, TextMatchOptions } from '../../matches';\nimport { filterNodeByType } from '../filterNodeByType';\nimport { getTextContent } from '../getTextContent';\n\nexport function matchTextContent(\n node: ReactTestInstance,\n text: TextMatch,\n options: TextMatchOptions = {}\n) {\n if (!filterNodeByType(node, Text)) {\n return false;\n }\n\n const textContent = getTextContent(node);\n const { exact, normalizer } = options;\n return matches(text, textContent, normalizer, exact);\n}\n"],"mappings":";;;;;;AAAA;AAEA;AACA;AACA;AAEO,SAASA,gBAAgB,CAC9BC,IAAuB,EACvBC,IAAe,EACfC,OAAyB,GAAG,CAAC,CAAC,EAC9B;EACA,IAAI,CAAC,IAAAC,kCAAgB,EAACH,IAAI,EAAEI,iBAAI,CAAC,EAAE;IACjC,OAAO,KAAK;EACd;EAEA,MAAMC,WAAW,GAAG,IAAAC,8BAAc,EAACN,IAAI,CAAC;EACxC,MAAM;IAAEO,KAAK;IAAEC;EAAW,CAAC,GAAGN,OAAO;EACrC,OAAO,IAAAO,gBAAO,EAACR,IAAI,EAAEI,WAAW,EAAEG,UAAU,EAAED,KAAK,CAAC;AACtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timers.js","names":["globalObj","window","global","runWithRealTimers","callback","fakeTimersType","getJestFakeTimersType","jest","useRealTimers","callbackReturnValue","fakeTimersConfig","getFakeTimersConfigFromType","useFakeTimers","setTimeout","process","env","RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS","_isMockFunction","clock","getRealSystemTime","type","legacyFakeTimers","jestFakeTimersAreEnabled","Boolean","setImmediatePolyfill","fn","bindTimeFunctions","clearTimeoutFn","clearTimeout","setImmediateFn","setImmediate","setTimeoutFn"],"sources":["../../src/helpers/timers.ts"],"sourcesContent":["// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/main/src/helpers.js\n/* globals jest */\nconst globalObj = typeof window === 'undefined' ? global : window;\n\ntype FakeTimersTypes = 'modern' | 'legacy';\n\n// Currently this fn only supports jest timers, but it could support other test runners in the future.\nfunction runWithRealTimers<T>(callback: () => T): T {\n const fakeTimersType = getJestFakeTimersType();\n if (fakeTimersType) {\n jest.useRealTimers();\n }\n\n const callbackReturnValue = callback();\n\n if (fakeTimersType) {\n const fakeTimersConfig = getFakeTimersConfigFromType(fakeTimersType);\n jest.useFakeTimers(fakeTimersConfig);\n }\n\n return callbackReturnValue;\n}\n\nfunction getJestFakeTimersType(): FakeTimersTypes | null {\n // istanbul ignore if\n if (\n typeof jest === 'undefined' ||\n typeof globalObj.setTimeout === 'undefined' ||\n process.env.RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS\n ) {\n return null;\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout._isMockFunction !== 'undefined' &&\n // @ts-expect-error jest mutates setTimeout\n globalObj.setTimeout._isMockFunction\n ) {\n return 'legacy';\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout.clock !== 'undefined' &&\n typeof jest.getRealSystemTime !== 'undefined'\n ) {\n try {\n // jest.getRealSystemTime is only supported for Jest's `modern` fake timers and otherwise throws\n jest.getRealSystemTime();\n return 'modern';\n } catch {\n // not using Jest's modern fake timers\n }\n }\n\n return null;\n}\n\nfunction getFakeTimersConfigFromType(type: FakeTimersTypes) {\n return type === 'legacy'\n ? { legacyFakeTimers: true }\n : { legacyFakeTimers: false };\n}\n\nconst jestFakeTimersAreEnabled = (): boolean =>\n Boolean(getJestFakeTimersType());\n\n// we only run our tests in node, and setImmediate is supported in node.\nfunction setImmediatePolyfill(fn: Function) {\n return globalObj.setTimeout(fn, 0);\n}\n\ntype BindTimeFunctions = {\n clearTimeoutFn: typeof clearTimeout;\n setImmediateFn: typeof setImmediate;\n setTimeoutFn: typeof setTimeout;\n};\n\nfunction bindTimeFunctions(): BindTimeFunctions {\n return {\n clearTimeoutFn: globalObj.clearTimeout,\n setImmediateFn: globalObj.setImmediate || setImmediatePolyfill,\n setTimeoutFn: globalObj.setTimeout,\n };\n}\n\nconst { clearTimeoutFn, setImmediateFn, setTimeoutFn } = runWithRealTimers(\n bindTimeFunctions\n) as BindTimeFunctions;\n\nexport {\n runWithRealTimers,\n jestFakeTimersAreEnabled,\n clearTimeoutFn as clearTimeout,\n setImmediateFn as setImmediate,\n setTimeoutFn as setTimeout,\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA,MAAMA,SAAS,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGC,MAAM,GAAGD,MAAM;AAIjE;AACA,SAASE,iBAAiB,CAAIC,QAAiB,EAAK;EAClD,MAAMC,cAAc,GAAGC,qBAAqB,EAAE;EAC9C,IAAID,cAAc,EAAE;IAClBE,IAAI,CAACC,aAAa,EAAE;EACtB;EAEA,MAAMC,mBAAmB,GAAGL,QAAQ,EAAE;EAEtC,IAAIC,cAAc,EAAE;IAClB,MAAMK,gBAAgB,GAAGC,2BAA2B,CAACN,cAAc,CAAC;IACpEE,IAAI,CAACK,aAAa,CAACF,gBAAgB,CAAC;EACtC;EAEA,OAAOD,mBAAmB;AAC5B;AAEA,SAASH,qBAAqB,GAA2B;EACvD;EACA,IACE,OAAOC,IAAI,KAAK,WAAW,IAC3B,OAAOP,SAAS,CAACa,UAAU,KAAK,WAAW,IAC3CC,OAAO,CAACC,GAAG,CAACC,iCAAiC,EAC7C;IACA,OAAO,IAAI;EACb;EAEA;EACE;EACA,OAAOhB,SAAS,CAACa,UAAU,CAACI,eAAe,KAAK,WAAW;EAC3D;EACAjB,SAAS,CAACa,UAAU,CAACI,eAAe,EACpC;IACA,OAAO,QAAQ;EACjB;EAEA;EACE;EACA,OAAOjB,SAAS,CAACa,UAAU,CAACK,KAAK,KAAK,WAAW,IACjD,OAAOX,IAAI,CAACY,iBAAiB,KAAK,WAAW,EAC7C;IACA,IAAI;MACF;MACAZ,IAAI,CAACY,iBAAiB,EAAE;MACxB,OAAO,QAAQ;IACjB,CAAC,CAAC,MAAM;MACN;
|
|
1
|
+
{"version":3,"file":"timers.js","names":["globalObj","window","global","runWithRealTimers","callback","fakeTimersType","getJestFakeTimersType","jest","useRealTimers","callbackReturnValue","fakeTimersConfig","getFakeTimersConfigFromType","useFakeTimers","setTimeout","process","env","RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS","_isMockFunction","clock","getRealSystemTime","type","legacyFakeTimers","jestFakeTimersAreEnabled","Boolean","setImmediatePolyfill","fn","bindTimeFunctions","clearTimeoutFn","clearTimeout","setImmediateFn","setImmediate","setTimeoutFn"],"sources":["../../src/helpers/timers.ts"],"sourcesContent":["// Most content of this file sourced directly from https://github.com/testing-library/dom-testing-library/blob/main/src/helpers.js\n/* globals jest */\nconst globalObj = typeof window === 'undefined' ? global : window;\n\ntype FakeTimersTypes = 'modern' | 'legacy';\n\n// Currently this fn only supports jest timers, but it could support other test runners in the future.\nfunction runWithRealTimers<T>(callback: () => T): T {\n const fakeTimersType = getJestFakeTimersType();\n if (fakeTimersType) {\n jest.useRealTimers();\n }\n\n const callbackReturnValue = callback();\n\n if (fakeTimersType) {\n const fakeTimersConfig = getFakeTimersConfigFromType(fakeTimersType);\n jest.useFakeTimers(fakeTimersConfig);\n }\n\n return callbackReturnValue;\n}\n\nfunction getJestFakeTimersType(): FakeTimersTypes | null {\n // istanbul ignore if\n if (\n typeof jest === 'undefined' ||\n typeof globalObj.setTimeout === 'undefined' ||\n process.env.RNTL_SKIP_AUTO_DETECT_FAKE_TIMERS\n ) {\n return null;\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout._isMockFunction !== 'undefined' &&\n // @ts-expect-error jest mutates setTimeout\n globalObj.setTimeout._isMockFunction\n ) {\n return 'legacy';\n }\n\n if (\n // @ts-expect-error jest mutates setTimeout\n typeof globalObj.setTimeout.clock !== 'undefined' &&\n typeof jest.getRealSystemTime !== 'undefined'\n ) {\n try {\n // jest.getRealSystemTime is only supported for Jest's `modern` fake timers and otherwise throws\n jest.getRealSystemTime();\n return 'modern';\n } catch {\n // not using Jest's modern fake timers\n }\n }\n\n return null;\n}\n\nfunction getFakeTimersConfigFromType(type: FakeTimersTypes) {\n return type === 'legacy'\n ? { legacyFakeTimers: true }\n : { legacyFakeTimers: false };\n}\n\nconst jestFakeTimersAreEnabled = (): boolean =>\n Boolean(getJestFakeTimersType());\n\n// we only run our tests in node, and setImmediate is supported in node.\nfunction setImmediatePolyfill(fn: Function) {\n return globalObj.setTimeout(fn, 0);\n}\n\ntype BindTimeFunctions = {\n clearTimeoutFn: typeof clearTimeout;\n setImmediateFn: typeof setImmediate;\n setTimeoutFn: typeof setTimeout;\n};\n\nfunction bindTimeFunctions(): BindTimeFunctions {\n return {\n clearTimeoutFn: globalObj.clearTimeout,\n setImmediateFn: globalObj.setImmediate || setImmediatePolyfill,\n setTimeoutFn: globalObj.setTimeout,\n };\n}\n\nconst { clearTimeoutFn, setImmediateFn, setTimeoutFn } = runWithRealTimers(\n bindTimeFunctions\n) as BindTimeFunctions;\n\nexport {\n runWithRealTimers,\n jestFakeTimersAreEnabled,\n clearTimeoutFn as clearTimeout,\n setImmediateFn as setImmediate,\n setTimeoutFn as setTimeout,\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA,MAAMA,SAAS,GAAG,OAAOC,MAAM,KAAK,WAAW,GAAGC,MAAM,GAAGD,MAAM;AAIjE;AACA,SAASE,iBAAiB,CAAIC,QAAiB,EAAK;EAClD,MAAMC,cAAc,GAAGC,qBAAqB,EAAE;EAC9C,IAAID,cAAc,EAAE;IAClBE,IAAI,CAACC,aAAa,EAAE;EACtB;EAEA,MAAMC,mBAAmB,GAAGL,QAAQ,EAAE;EAEtC,IAAIC,cAAc,EAAE;IAClB,MAAMK,gBAAgB,GAAGC,2BAA2B,CAACN,cAAc,CAAC;IACpEE,IAAI,CAACK,aAAa,CAACF,gBAAgB,CAAC;EACtC;EAEA,OAAOD,mBAAmB;AAC5B;AAEA,SAASH,qBAAqB,GAA2B;EACvD;EACA,IACE,OAAOC,IAAI,KAAK,WAAW,IAC3B,OAAOP,SAAS,CAACa,UAAU,KAAK,WAAW,IAC3CC,OAAO,CAACC,GAAG,CAACC,iCAAiC,EAC7C;IACA,OAAO,IAAI;EACb;EAEA;EACE;EACA,OAAOhB,SAAS,CAACa,UAAU,CAACI,eAAe,KAAK,WAAW;EAC3D;EACAjB,SAAS,CAACa,UAAU,CAACI,eAAe,EACpC;IACA,OAAO,QAAQ;EACjB;EAEA;EACE;EACA,OAAOjB,SAAS,CAACa,UAAU,CAACK,KAAK,KAAK,WAAW,IACjD,OAAOX,IAAI,CAACY,iBAAiB,KAAK,WAAW,EAC7C;IACA,IAAI;MACF;MACAZ,IAAI,CAACY,iBAAiB,EAAE;MACxB,OAAO,QAAQ;IACjB,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ;EAEA,OAAO,IAAI;AACb;AAEA,SAASR,2BAA2B,CAACS,IAAqB,EAAE;EAC1D,OAAOA,IAAI,KAAK,QAAQ,GACpB;IAAEC,gBAAgB,EAAE;EAAK,CAAC,GAC1B;IAAEA,gBAAgB,EAAE;EAAM,CAAC;AACjC;AAEA,MAAMC,wBAAwB,GAAG,MAC/BC,OAAO,CAACjB,qBAAqB,EAAE,CAAC;;AAElC;AAAA;AACA,SAASkB,oBAAoB,CAACC,EAAY,EAAE;EAC1C,OAAOzB,SAAS,CAACa,UAAU,CAACY,EAAE,EAAE,CAAC,CAAC;AACpC;AAQA,SAASC,iBAAiB,GAAsB;EAC9C,OAAO;IACLC,cAAc,EAAE3B,SAAS,CAAC4B,YAAY;IACtCC,cAAc,EAAE7B,SAAS,CAAC8B,YAAY,IAAIN,oBAAoB;IAC9DO,YAAY,EAAE/B,SAAS,CAACa;EAC1B,CAAC;AACH;AAEA,MAAM;EAAEc,cAAc;EAAEE,cAAc;EAAEE;AAAa,CAAC,GAAG5B,iBAAiB,CACxEuB,iBAAiB,CACG;AAAC;AAAA;AAAA"}
|