@testing-library/react-native 10.0.1 → 11.0.0-rc.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 +8 -6
- package/build/cleanup.js +4 -0
- package/build/cleanup.js.map +1 -1
- package/build/fireEvent.js +15 -13
- package/build/fireEvent.js.map +1 -1
- package/build/helpers/errors.js +1 -3
- package/build/helpers/errors.js.map +1 -1
- package/build/helpers/matchers/matchArrayProp.d.ts +8 -0
- package/build/helpers/matchers/matchArrayProp.js +26 -0
- package/build/helpers/matchers/matchArrayProp.js.map +1 -0
- package/build/helpers/matchers/matchObjectProp.d.ts +12 -0
- package/build/helpers/matchers/matchObjectProp.js +27 -0
- package/build/helpers/matchers/matchObjectProp.js.map +1 -0
- package/build/helpers/matchers/matchStringProp.d.ts +9 -0
- package/build/helpers/matchers/matchStringProp.js +26 -0
- package/build/helpers/matchers/matchStringProp.js.map +1 -0
- package/build/helpers/timers.js +12 -2
- package/build/helpers/timers.js.map +1 -1
- package/build/index.flow.js +8 -24
- package/build/matches.js +2 -1
- package/build/matches.js.map +1 -1
- package/build/pure.d.ts +5 -2
- package/build/pure.js +8 -0
- package/build/pure.js.map +1 -1
- package/build/queries/a11yState.d.ts +18 -0
- package/build/queries/a11yState.js +53 -0
- package/build/queries/a11yState.js.map +1 -0
- package/build/queries/a11yValue.d.ts +24 -0
- package/build/queries/a11yValue.js +53 -0
- package/build/queries/a11yValue.js.map +1 -0
- package/build/queries/hintText.d.ts +24 -0
- package/build/queries/hintText.js +61 -0
- package/build/queries/hintText.js.map +1 -0
- package/build/queries/labelText.d.ts +12 -0
- package/build/queries/labelText.js +39 -0
- package/build/queries/labelText.js.map +1 -0
- package/build/queries/makeQueries.d.ts +6 -6
- package/build/queries/makeQueries.js +4 -36
- package/build/queries/makeQueries.js.map +1 -1
- package/build/queries/role.d.ts +12 -0
- package/build/queries/role.js +39 -0
- package/build/queries/role.js.map +1 -0
- package/build/queries/text.js +1 -3
- package/build/queries/text.js.map +1 -1
- package/build/render.d.ts +107 -64
- package/build/render.js +5 -1
- package/build/render.js.map +1 -1
- package/build/renderHook.js +2 -2
- package/build/renderHook.js.map +1 -1
- package/build/screen.d.ts +4 -0
- package/build/screen.js +127 -0
- package/build/screen.js.map +1 -0
- package/build/waitFor.js +1 -1
- package/build/waitFor.js.map +1 -1
- package/build/within.d.ts +106 -64
- package/build/within.js +16 -4
- package/build/within.js.map +1 -1
- package/package.json +21 -17
- package/typings/index.flow.js +8 -24
- package/build/queries/a11yAPI.d.ts +0 -66
- package/build/queries/a11yAPI.js +0 -94
- package/build/queries/a11yAPI.js.map +0 -1
- package/build/queries/makeA11yQuery.d.ts +0 -13
- package/build/queries/makeA11yQuery.js +0 -80
- package/build/queries/makeA11yQuery.js.map +0 -1
package/build/within.d.ts
CHANGED
|
@@ -1,94 +1,136 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { ReactTestInstance } from 'react-test-renderer';
|
|
3
3
|
export declare function within(instance: ReactTestInstance): {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
findAllByHintText: (a11yHint: import("./matches").TextMatch, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
22
|
-
getByRole: (role: RegExp | import("react-native").AccessibilityRole) => ReactTestInstance;
|
|
23
|
-
getAllByRole: (role: RegExp | import("react-native").AccessibilityRole) => ReactTestInstance[];
|
|
24
|
-
queryByRole: (role: RegExp | import("react-native").AccessibilityRole) => ReactTestInstance | null;
|
|
25
|
-
queryAllByRole: (role: RegExp | import("react-native").AccessibilityRole) => ReactTestInstance[];
|
|
26
|
-
findByRole: (role: import("react-native").AccessibilityRole, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance>;
|
|
27
|
-
findAllByRole: (role: import("react-native").AccessibilityRole, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
28
|
-
getByA11yStates: (accessibilityStateKey: keyof import("react-native").AccessibilityState | (keyof import("react-native").AccessibilityState)[]) => ReactTestInstance;
|
|
29
|
-
getAllByA11yStates: (accessibilityStateKey: keyof import("react-native").AccessibilityState | (keyof import("react-native").AccessibilityState)[]) => ReactTestInstance[];
|
|
30
|
-
queryByA11yStates: (accessibilityStateKey: keyof import("react-native").AccessibilityState | (keyof import("react-native").AccessibilityState)[]) => ReactTestInstance | null;
|
|
31
|
-
queryAllByA11yStates: (accessibilityStateKey: keyof import("react-native").AccessibilityState | (keyof import("react-native").AccessibilityState)[]) => ReactTestInstance[];
|
|
32
|
-
findByA11yStates: (accessibilityStateKey: keyof import("react-native").AccessibilityState, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance>;
|
|
33
|
-
findAllByA11yStates: (accessibilityStateKey: keyof import("react-native").AccessibilityState, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
34
|
-
getByA11yState: (accessibilityState: import("react-native").AccessibilityState) => ReactTestInstance;
|
|
35
|
-
getAllByA11yState: (accessibilityState: import("react-native").AccessibilityState) => ReactTestInstance[];
|
|
36
|
-
queryByA11yState: (accessibilityState: import("react-native").AccessibilityState) => ReactTestInstance | null;
|
|
37
|
-
queryAllByA11yState: (accessibilityState: import("react-native").AccessibilityState) => ReactTestInstance[];
|
|
38
|
-
findByA11yState: (accessibilityState: import("react-native").AccessibilityState, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance>;
|
|
39
|
-
findAllByA11yState: (accessibilityState: import("react-native").AccessibilityState, waitForOptions?: import("./waitFor").WaitForOptions | undefined) => Promise<ReactTestInstance[]>;
|
|
40
|
-
getByA11yValue: (a11yValue: {
|
|
4
|
+
UNSAFE_getByProps: (props: {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
}) => ReactTestInstance;
|
|
7
|
+
UNSAFE_getAllByProps: (props: {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}) => ReactTestInstance[];
|
|
10
|
+
UNSAFE_queryByProps: (props: {
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}) => ReactTestInstance | null;
|
|
13
|
+
UNSAFE_queryAllByProps: (props: {
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}) => ReactTestInstance[];
|
|
16
|
+
UNSAFE_getByType: <P>(type: import("react").ComponentType<P>) => ReactTestInstance;
|
|
17
|
+
UNSAFE_getAllByType: <P_1>(type: import("react").ComponentType<P_1>) => ReactTestInstance[];
|
|
18
|
+
UNSAFE_queryByType: <P_2>(type: import("react").ComponentType<P_2>) => ReactTestInstance | null;
|
|
19
|
+
UNSAFE_queryAllByType: <P_3>(type: import("react").ComponentType<P_3>) => ReactTestInstance[];
|
|
20
|
+
getByA11yValue: import("./queries/makeQueries").GetByQuery<{
|
|
41
21
|
min?: number | undefined;
|
|
42
22
|
max?: number | undefined;
|
|
43
23
|
now?: number | undefined;
|
|
44
24
|
text?: string | undefined;
|
|
45
|
-
}
|
|
46
|
-
getAllByA11yValue: (
|
|
25
|
+
}, void>;
|
|
26
|
+
getAllByA11yValue: import("./queries/makeQueries").GetAllByQuery<{
|
|
47
27
|
min?: number | undefined;
|
|
48
28
|
max?: number | undefined;
|
|
49
29
|
now?: number | undefined;
|
|
50
30
|
text?: string | undefined;
|
|
51
|
-
}
|
|
52
|
-
queryByA11yValue: (
|
|
31
|
+
}, void>;
|
|
32
|
+
queryByA11yValue: import("./queries/makeQueries").QueryByQuery<{
|
|
53
33
|
min?: number | undefined;
|
|
54
34
|
max?: number | undefined;
|
|
55
35
|
now?: number | undefined;
|
|
56
36
|
text?: string | undefined;
|
|
57
|
-
}
|
|
58
|
-
queryAllByA11yValue: (
|
|
37
|
+
}, void>;
|
|
38
|
+
queryAllByA11yValue: import("./queries/makeQueries").QueryAllByQuery<{
|
|
59
39
|
min?: number | undefined;
|
|
60
40
|
max?: number | undefined;
|
|
61
41
|
now?: number | undefined;
|
|
62
42
|
text?: string | undefined;
|
|
63
|
-
}
|
|
64
|
-
findByA11yValue: (
|
|
43
|
+
}, void>;
|
|
44
|
+
findByA11yValue: import("./queries/makeQueries").FindByQuery<{
|
|
65
45
|
min?: number | undefined;
|
|
66
46
|
max?: number | undefined;
|
|
67
47
|
now?: number | undefined;
|
|
68
48
|
text?: string | undefined;
|
|
69
|
-
},
|
|
70
|
-
findAllByA11yValue: (
|
|
49
|
+
}, void>;
|
|
50
|
+
findAllByA11yValue: import("./queries/makeQueries").FindAllByQuery<{
|
|
71
51
|
min?: number | undefined;
|
|
72
52
|
max?: number | undefined;
|
|
73
53
|
now?: number | undefined;
|
|
74
54
|
text?: string | undefined;
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
55
|
+
}, void>;
|
|
56
|
+
getByAccessibilityValue: import("./queries/makeQueries").GetByQuery<{
|
|
57
|
+
min?: number | undefined;
|
|
58
|
+
max?: number | undefined;
|
|
59
|
+
now?: number | undefined;
|
|
60
|
+
text?: string | undefined;
|
|
61
|
+
}, void>;
|
|
62
|
+
getAllByAccessibilityValue: import("./queries/makeQueries").GetAllByQuery<{
|
|
63
|
+
min?: number | undefined;
|
|
64
|
+
max?: number | undefined;
|
|
65
|
+
now?: number | undefined;
|
|
66
|
+
text?: string | undefined;
|
|
67
|
+
}, void>;
|
|
68
|
+
queryByAccessibilityValue: import("./queries/makeQueries").QueryByQuery<{
|
|
69
|
+
min?: number | undefined;
|
|
70
|
+
max?: number | undefined;
|
|
71
|
+
now?: number | undefined;
|
|
72
|
+
text?: string | undefined;
|
|
73
|
+
}, void>;
|
|
74
|
+
queryAllByAccessibilityValue: import("./queries/makeQueries").QueryAllByQuery<{
|
|
75
|
+
min?: number | undefined;
|
|
76
|
+
max?: number | undefined;
|
|
77
|
+
now?: number | undefined;
|
|
78
|
+
text?: string | undefined;
|
|
79
|
+
}, void>;
|
|
80
|
+
findByAccessibilityValue: import("./queries/makeQueries").FindByQuery<{
|
|
81
|
+
min?: number | undefined;
|
|
82
|
+
max?: number | undefined;
|
|
83
|
+
now?: number | undefined;
|
|
84
|
+
text?: string | undefined;
|
|
85
|
+
}, void>;
|
|
86
|
+
findAllByAccessibilityValue: import("./queries/makeQueries").FindAllByQuery<{
|
|
87
|
+
min?: number | undefined;
|
|
88
|
+
max?: number | undefined;
|
|
89
|
+
now?: number | undefined;
|
|
90
|
+
text?: string | undefined;
|
|
91
|
+
}, void>;
|
|
92
|
+
getByA11yState: import("./queries/makeQueries").GetByQuery<import("react-native").AccessibilityState, void>;
|
|
93
|
+
getAllByA11yState: import("./queries/makeQueries").GetAllByQuery<import("react-native").AccessibilityState, void>;
|
|
94
|
+
queryByA11yState: import("./queries/makeQueries").QueryByQuery<import("react-native").AccessibilityState, void>;
|
|
95
|
+
queryAllByA11yState: import("./queries/makeQueries").QueryAllByQuery<import("react-native").AccessibilityState, void>;
|
|
96
|
+
findByA11yState: import("./queries/makeQueries").FindByQuery<import("react-native").AccessibilityState, void>;
|
|
97
|
+
findAllByA11yState: import("./queries/makeQueries").FindAllByQuery<import("react-native").AccessibilityState, void>;
|
|
98
|
+
getByAccessibilityState: import("./queries/makeQueries").GetByQuery<import("react-native").AccessibilityState, void>;
|
|
99
|
+
getAllByAccessibilityState: import("./queries/makeQueries").GetAllByQuery<import("react-native").AccessibilityState, void>;
|
|
100
|
+
queryByAccessibilityState: import("./queries/makeQueries").QueryByQuery<import("react-native").AccessibilityState, void>;
|
|
101
|
+
queryAllByAccessibilityState: import("./queries/makeQueries").QueryAllByQuery<import("react-native").AccessibilityState, void>;
|
|
102
|
+
findByAccessibilityState: import("./queries/makeQueries").FindByQuery<import("react-native").AccessibilityState, void>;
|
|
103
|
+
findAllByAccessibilityState: import("./queries/makeQueries").FindAllByQuery<import("react-native").AccessibilityState, void>;
|
|
104
|
+
getByRole: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
|
|
105
|
+
getAllByRole: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
|
|
106
|
+
queryByRole: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
|
|
107
|
+
queryAllByRole: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
|
|
108
|
+
findByRole: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
|
|
109
|
+
findAllByRole: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
|
|
110
|
+
getByHintText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
|
|
111
|
+
getAllByHintText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
|
|
112
|
+
queryByHintText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
|
|
113
|
+
queryAllByHintText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
|
|
114
|
+
findByHintText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
|
|
115
|
+
findAllByHintText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
|
|
116
|
+
getByA11yHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
|
|
117
|
+
getAllByA11yHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
|
|
118
|
+
queryByA11yHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
|
|
119
|
+
queryAllByA11yHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
|
|
120
|
+
findByA11yHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
|
|
121
|
+
findAllByA11yHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
|
|
122
|
+
getByAccessibilityHint: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
|
|
123
|
+
getAllByAccessibilityHint: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
|
|
124
|
+
queryByAccessibilityHint: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
|
|
125
|
+
queryAllByAccessibilityHint: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
|
|
126
|
+
findByAccessibilityHint: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
|
|
127
|
+
findAllByAccessibilityHint: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
|
|
128
|
+
getByLabelText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, void>;
|
|
129
|
+
getAllByLabelText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, void>;
|
|
130
|
+
queryByLabelText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, void>;
|
|
131
|
+
queryAllByLabelText: import("./queries/makeQueries").QueryAllByQuery<import("./matches").TextMatch, void>;
|
|
132
|
+
findByLabelText: import("./queries/makeQueries").FindByQuery<import("./matches").TextMatch, void>;
|
|
133
|
+
findAllByLabelText: import("./queries/makeQueries").FindAllByQuery<import("./matches").TextMatch, void>;
|
|
92
134
|
getByPlaceholderText: import("./queries/makeQueries").GetByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
93
135
|
getAllByPlaceholderText: import("./queries/makeQueries").GetAllByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
|
94
136
|
queryByPlaceholderText: import("./queries/makeQueries").QueryByQuery<import("./matches").TextMatch, import("./queries/text").TextMatchOptions>;
|
package/build/within.js
CHANGED
|
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getQueriesForElement = void 0;
|
|
7
7
|
exports.within = within;
|
|
8
8
|
|
|
9
|
-
var _a11yAPI = require("./queries/a11yAPI");
|
|
10
|
-
|
|
11
9
|
var _text = require("./queries/text");
|
|
12
10
|
|
|
13
11
|
var _testId = require("./queries/testId");
|
|
@@ -16,6 +14,16 @@ var _displayValue = require("./queries/displayValue");
|
|
|
16
14
|
|
|
17
15
|
var _placeholderText = require("./queries/placeholderText");
|
|
18
16
|
|
|
17
|
+
var _labelText = require("./queries/labelText");
|
|
18
|
+
|
|
19
|
+
var _hintText = require("./queries/hintText");
|
|
20
|
+
|
|
21
|
+
var _role = require("./queries/role");
|
|
22
|
+
|
|
23
|
+
var _a11yState = require("./queries/a11yState");
|
|
24
|
+
|
|
25
|
+
var _a11yValue = require("./queries/a11yValue");
|
|
26
|
+
|
|
19
27
|
var _unsafeType = require("./queries/unsafeType");
|
|
20
28
|
|
|
21
29
|
var _unsafeProps = require("./queries/unsafeProps");
|
|
@@ -25,9 +33,13 @@ function within(instance) {
|
|
|
25
33
|
...(0, _testId.bindByTestIdQueries)(instance),
|
|
26
34
|
...(0, _displayValue.bindByDisplayValueQueries)(instance),
|
|
27
35
|
...(0, _placeholderText.bindByPlaceholderTextQueries)(instance),
|
|
36
|
+
...(0, _labelText.bindByLabelTextQueries)(instance),
|
|
37
|
+
...(0, _hintText.bindByHintTextQueries)(instance),
|
|
38
|
+
...(0, _role.bindByRoleQueries)(instance),
|
|
39
|
+
...(0, _a11yState.bindByA11yStateQueries)(instance),
|
|
40
|
+
...(0, _a11yValue.bindByA11yValueQueries)(instance),
|
|
28
41
|
...(0, _unsafeType.bindUnsafeByTypeQueries)(instance),
|
|
29
|
-
...(0, _unsafeProps.bindUnsafeByPropsQueries)(instance)
|
|
30
|
-
...(0, _a11yAPI.a11yAPI)(instance)
|
|
42
|
+
...(0, _unsafeProps.bindUnsafeByPropsQueries)(instance)
|
|
31
43
|
};
|
|
32
44
|
}
|
|
33
45
|
|
package/build/within.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
1
|
+
{"version":3,"sources":["../src/within.ts"],"names":["within","instance","getQueriesForElement"],"mappings":";;;;;;;;AACA;;AACA;;AACA;;AACA;;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,uCAAuBA,QAAvB,CALE;AAML,OAAG,qCAAsBA,QAAtB,CANE;AAOL,OAAG,6BAAkBA,QAAlB,CAPE;AAQL,OAAG,uCAAuBA,QAAvB,CARE;AASL,OAAG,uCAAuBA,QAAvB,CATE;AAUL,OAAG,yCAAwBA,QAAxB,CAVE;AAWL,OAAG,2CAAyBA,QAAzB;AAXE,GAAP;AAaD;;AAEM,MAAMC,oBAAoB,GAAGF,MAA7B","sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { bindByTextQueries } from './queries/text';\nimport { bindByTestIdQueries } from './queries/testId';\nimport { bindByDisplayValueQueries } from './queries/displayValue';\nimport { bindByPlaceholderTextQueries } from './queries/placeholderText';\nimport { bindByLabelTextQueries } from './queries/labelText';\nimport { bindByHintTextQueries } from './queries/hintText';\nimport { bindByRoleQueries } from './queries/role';\nimport { bindByA11yStateQueries } from './queries/a11yState';\nimport { bindByA11yValueQueries } from './queries/a11yValue';\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 ...bindByLabelTextQueries(instance),\n ...bindByHintTextQueries(instance),\n ...bindByRoleQueries(instance),\n ...bindByA11yStateQueries(instance),\n ...bindByA11yValueQueries(instance),\n ...bindUnsafeByTypeQueries(instance),\n ...bindUnsafeByPropsQueries(instance),\n };\n}\n\nexport const getQueriesForElement = within;\n"],"file":"within.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@testing-library/react-native",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.0-rc.0",
|
|
4
4
|
"description": "Simple and complete React Native testing utilities that encourage good testing practices.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/cli": "^7.8.4",
|
|
30
30
|
"@babel/core": "^7.9.0",
|
|
31
31
|
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
|
32
|
-
"@babel/plugin-transform-flow-strip-types": "^7.
|
|
32
|
+
"@babel/plugin-transform-flow-strip-types": "^7.18.0",
|
|
33
33
|
"@babel/preset-env": "^7.9.6",
|
|
34
34
|
"@babel/preset-flow": "^7.9.0",
|
|
35
35
|
"@babel/preset-react": "^7.9.4",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"@callstack/eslint-config": "^11.0.0",
|
|
38
38
|
"@release-it/conventional-changelog": "^2.0.0",
|
|
39
39
|
"@testing-library/jest-native": "~4.0.2",
|
|
40
|
-
"@types/jest": "^
|
|
41
|
-
"@types/react": "^
|
|
42
|
-
"@types/react-native": "^0.
|
|
43
|
-
"@types/react-test-renderer": "^
|
|
44
|
-
"babel-jest": "^
|
|
40
|
+
"@types/jest": "^28.0.0",
|
|
41
|
+
"@types/react": "^18.0.0",
|
|
42
|
+
"@types/react-native": "^0.69.1",
|
|
43
|
+
"@types/react-test-renderer": "^18.0.0",
|
|
44
|
+
"babel-jest": "^28.0.0",
|
|
45
45
|
"conventional-changelog-cli": "^2.0.11",
|
|
46
46
|
"cp-cli": "^2.0.0",
|
|
47
47
|
"dedent": "^0.7.0",
|
|
48
48
|
"del-cli": "^3.0.1",
|
|
49
|
-
"eslint": "^7.
|
|
50
|
-
"flow-bin": "
|
|
49
|
+
"eslint": "^7.32.0",
|
|
50
|
+
"flow-bin": "~0.170.0",
|
|
51
51
|
"flow-copy-source": "^2.0.9",
|
|
52
|
-
"jest": "^
|
|
53
|
-
"react": "^
|
|
54
|
-
"react-native": "
|
|
55
|
-
"react-test-renderer": "^
|
|
52
|
+
"jest": "^28.0.0",
|
|
53
|
+
"react": "^18.0.0",
|
|
54
|
+
"react-native": "~0.69.1",
|
|
55
|
+
"react-test-renderer": "^18.0.0",
|
|
56
56
|
"release-it": "^14.0.3",
|
|
57
57
|
"strip-ansi": "^6.0.0",
|
|
58
58
|
"typescript": "^4.0.2"
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
"scripts": {
|
|
69
69
|
"clean": "del build",
|
|
70
70
|
"test": "jest",
|
|
71
|
+
"test:ci": "jest --maxWorkers=2",
|
|
71
72
|
"typecheck": "tsc",
|
|
72
73
|
"flow": "flow",
|
|
73
74
|
"copy-flowtypes": "cp typings/index.flow.js build",
|
|
@@ -82,12 +83,15 @@
|
|
|
82
83
|
"prepare": "yarn build"
|
|
83
84
|
},
|
|
84
85
|
"jest": {
|
|
85
|
-
"preset": "
|
|
86
|
-
"
|
|
86
|
+
"preset": "./jest-preset",
|
|
87
|
+
"setupFiles": [
|
|
88
|
+
"./jestSetup.js"
|
|
89
|
+
],
|
|
87
90
|
"testPathIgnorePatterns": [
|
|
88
|
-
"timerUtils"
|
|
91
|
+
"timerUtils",
|
|
92
|
+
"examples/"
|
|
89
93
|
],
|
|
90
|
-
"testTimeout":
|
|
94
|
+
"testTimeout": 60000,
|
|
91
95
|
"transformIgnorePatterns": [
|
|
92
96
|
"/node_modules/(?!(@react-native|react-native)/).*/"
|
|
93
97
|
]
|
package/typings/index.flow.js
CHANGED
|
@@ -56,16 +56,6 @@ declare type A11yState = {|
|
|
|
56
56
|
expanded?: boolean,
|
|
57
57
|
|};
|
|
58
58
|
|
|
59
|
-
declare type A11yStates =
|
|
60
|
-
| 'disabled'
|
|
61
|
-
| 'selected'
|
|
62
|
-
| 'checked'
|
|
63
|
-
| 'unchecked'
|
|
64
|
-
| 'busy'
|
|
65
|
-
| 'expanded'
|
|
66
|
-
| 'collapsed'
|
|
67
|
-
| 'hasPopup';
|
|
68
|
-
|
|
69
59
|
declare type A11yValue = {
|
|
70
60
|
min?: number,
|
|
71
61
|
max?: number,
|
|
@@ -266,25 +256,17 @@ interface A11yAPI {
|
|
|
266
256
|
waitForOptions?: WaitForOptions
|
|
267
257
|
) => FindAllReturn;
|
|
268
258
|
|
|
269
|
-
// States
|
|
270
|
-
getByA11yStates: (matcher: A11yStates | Array<A11yStates>) => GetReturn;
|
|
271
|
-
getAllByA11yStates: (matcher: A11yStates | Array<A11yStates>) => GetAllReturn;
|
|
272
|
-
queryByA11yStates: (matcher: A11yStates | Array<A11yStates>) => QueryReturn;
|
|
273
|
-
queryAllByA11yStates: (
|
|
274
|
-
matcher: A11yStates | Array<A11yStates>
|
|
275
|
-
) => QueryAllReturn;
|
|
276
|
-
|
|
277
259
|
// State
|
|
278
|
-
getByA11yState: (matcher:
|
|
279
|
-
getAllByA11yState: (matcher:
|
|
280
|
-
queryByA11yState: (matcher:
|
|
281
|
-
queryAllByA11yState: (matcher:
|
|
260
|
+
getByA11yState: (matcher: A11yState) => GetReturn;
|
|
261
|
+
getAllByA11yState: (matcher: A11yState) => GetAllReturn;
|
|
262
|
+
queryByA11yState: (matcher: A11yState) => QueryReturn;
|
|
263
|
+
queryAllByA11yState: (matcher: A11yState) => QueryAllReturn;
|
|
282
264
|
findByA11yState: (
|
|
283
|
-
matcher:
|
|
265
|
+
matcher: A11yState,
|
|
284
266
|
waitForOptions?: WaitForOptions
|
|
285
267
|
) => FindReturn;
|
|
286
268
|
findAllByA11yState: (
|
|
287
|
-
matcher:
|
|
269
|
+
matcher: A11yState,
|
|
288
270
|
waitForOptions?: WaitForOptions
|
|
289
271
|
) => FindAllReturn;
|
|
290
272
|
|
|
@@ -363,6 +345,8 @@ declare module '@testing-library/react-native' {
|
|
|
363
345
|
options?: RenderOptions
|
|
364
346
|
) => RenderAPI;
|
|
365
347
|
|
|
348
|
+
declare export var screen: RenderAPI;
|
|
349
|
+
|
|
366
350
|
declare export var cleanup: () => void;
|
|
367
351
|
declare export var fireEvent: FireEventAPI;
|
|
368
352
|
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { ReactTestInstance } from 'react-test-renderer';
|
|
2
|
-
import type { AccessibilityRole, AccessibilityState } from 'react-native';
|
|
3
|
-
import type { WaitForOptions } from '../waitFor';
|
|
4
|
-
import type { TextMatch } from '../matches';
|
|
5
|
-
declare type AccessibilityStateKey = keyof AccessibilityState;
|
|
6
|
-
declare type A11yValue = {
|
|
7
|
-
min?: number;
|
|
8
|
-
max?: number;
|
|
9
|
-
now?: number;
|
|
10
|
-
text?: string;
|
|
11
|
-
};
|
|
12
|
-
declare type GetReturn = ReactTestInstance;
|
|
13
|
-
declare type GetAllReturn = Array<ReactTestInstance>;
|
|
14
|
-
declare type QueryReturn = ReactTestInstance | null;
|
|
15
|
-
declare type QueryAllReturn = Array<ReactTestInstance>;
|
|
16
|
-
declare type FindReturn = Promise<GetReturn>;
|
|
17
|
-
declare type FindAllReturn = Promise<GetAllReturn>;
|
|
18
|
-
export declare type A11yAPI = {
|
|
19
|
-
getByLabelText: (label: TextMatch) => GetReturn;
|
|
20
|
-
getAllByLabelText: (label: TextMatch) => GetAllReturn;
|
|
21
|
-
queryByLabelText: (label: TextMatch) => QueryReturn;
|
|
22
|
-
queryAllByLabelText: (label: TextMatch) => QueryAllReturn;
|
|
23
|
-
findByLabelText: (label: TextMatch, waitForOptions?: WaitForOptions) => FindReturn;
|
|
24
|
-
findAllByLabelText: (label: TextMatch, waitForOptions?: WaitForOptions) => FindAllReturn;
|
|
25
|
-
getByA11yHint: (a11yHint: TextMatch) => GetReturn;
|
|
26
|
-
getByHintText: (a11yHint: TextMatch) => GetReturn;
|
|
27
|
-
getAllByA11yHint: (a11yHint: TextMatch) => GetAllReturn;
|
|
28
|
-
getAllByHintText: (a11yHint: TextMatch) => GetAllReturn;
|
|
29
|
-
queryByA11yHint: (a11yHint: TextMatch) => QueryReturn;
|
|
30
|
-
queryByHintText: (a11yHint: TextMatch) => QueryReturn;
|
|
31
|
-
queryAllByA11yHint: (a11yHint: TextMatch) => QueryAllReturn;
|
|
32
|
-
queryAllByHintText: (a11yHint: TextMatch) => QueryAllReturn;
|
|
33
|
-
findByA11yHint: (a11yHint: TextMatch, waitForOptions?: WaitForOptions) => FindReturn;
|
|
34
|
-
findByHintText: (a11yHint: TextMatch, waitForOptions?: WaitForOptions) => FindReturn;
|
|
35
|
-
findAllByA11yHint: (a11yHint: TextMatch, waitForOptions?: WaitForOptions) => FindAllReturn;
|
|
36
|
-
findAllByHintText: (a11yHint: TextMatch, waitForOptions?: WaitForOptions) => FindAllReturn;
|
|
37
|
-
getByRole: (role: AccessibilityRole | RegExp) => GetReturn;
|
|
38
|
-
getAllByRole: (role: AccessibilityRole | RegExp) => GetAllReturn;
|
|
39
|
-
queryByRole: (role: AccessibilityRole | RegExp) => QueryReturn;
|
|
40
|
-
queryAllByRole: (role: AccessibilityRole | RegExp) => QueryAllReturn;
|
|
41
|
-
findByRole: (role: AccessibilityRole, waitForOptions?: WaitForOptions) => FindReturn;
|
|
42
|
-
findAllByRole: (role: AccessibilityRole, waitForOptions?: WaitForOptions) => FindAllReturn;
|
|
43
|
-
getByA11yStates: (accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>) => GetReturn;
|
|
44
|
-
getAllByA11yStates: (accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>) => GetAllReturn;
|
|
45
|
-
queryByA11yStates: (accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>) => QueryReturn;
|
|
46
|
-
queryAllByA11yStates: (accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>) => QueryAllReturn;
|
|
47
|
-
findByA11yStates: (accessibilityStateKey: AccessibilityStateKey, waitForOptions?: WaitForOptions) => FindReturn;
|
|
48
|
-
findAllByA11yStates: (accessibilityStateKey: AccessibilityStateKey, waitForOptions?: WaitForOptions) => FindAllReturn;
|
|
49
|
-
getByA11yState: (accessibilityState: AccessibilityState) => GetReturn;
|
|
50
|
-
getAllByA11yState: (accessibilityState: AccessibilityState) => GetAllReturn;
|
|
51
|
-
queryByA11yState: (accessibilityState: AccessibilityState) => QueryReturn;
|
|
52
|
-
queryAllByA11yState: (accessibilityState: AccessibilityState) => QueryAllReturn;
|
|
53
|
-
findByA11yState: (accessibilityState: AccessibilityState, waitForOptions?: WaitForOptions) => FindReturn;
|
|
54
|
-
findAllByA11yState: (accessibilityState: AccessibilityState, waitForOptions?: WaitForOptions) => FindAllReturn;
|
|
55
|
-
getByA11yValue: (a11yValue: A11yValue) => GetReturn;
|
|
56
|
-
getAllByA11yValue: (a11yValue: A11yValue) => GetAllReturn;
|
|
57
|
-
queryByA11yValue: (a11yValue: A11yValue) => QueryReturn;
|
|
58
|
-
queryAllByA11yValue: (a11yValue: A11yValue) => QueryAllReturn;
|
|
59
|
-
findByA11yValue: (a11yValue: A11yValue, waitForOptions?: WaitForOptions) => FindReturn;
|
|
60
|
-
findAllByA11yValue: (a11yValue: A11yValue, waitForOptions?: WaitForOptions) => FindAllReturn;
|
|
61
|
-
};
|
|
62
|
-
export declare function matchStringValue(prop: string | undefined, matcher: TextMatch): boolean;
|
|
63
|
-
export declare function matchArrayValue(prop: Array<string> | undefined, matcher: string | Array<string>): boolean;
|
|
64
|
-
export declare function matchObject<T extends Record<string, unknown>>(prop: T | undefined, matcher: T): boolean;
|
|
65
|
-
export declare const a11yAPI: (instance: ReactTestInstance) => A11yAPI;
|
|
66
|
-
export {};
|
package/build/queries/a11yAPI.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.a11yAPI = void 0;
|
|
7
|
-
exports.matchArrayValue = matchArrayValue;
|
|
8
|
-
exports.matchObject = matchObject;
|
|
9
|
-
exports.matchStringValue = matchStringValue;
|
|
10
|
-
|
|
11
|
-
var _makeA11yQuery = _interopRequireDefault(require("./makeA11yQuery"));
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
15
|
-
function matchStringValue(prop, matcher) {
|
|
16
|
-
if (!prop) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (typeof matcher === 'string') {
|
|
21
|
-
return prop === matcher;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return Boolean(prop.match(matcher));
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function matchArrayValue(prop, matcher) {
|
|
28
|
-
if (!prop || matcher.length === 0) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (typeof matcher === 'string') {
|
|
33
|
-
return prop.includes(matcher);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return !matcher.some(e => !prop.includes(e));
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function matchObject(prop, matcher) {
|
|
40
|
-
return prop ? Object.keys(matcher).length !== 0 && Object.keys(prop).length !== 0 && !Object.keys(matcher).some(key => prop[key] !== matcher[key]) : false;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const a11yAPI = instance => ({ ...(0, _makeA11yQuery.default)('accessibilityLabel', {
|
|
44
|
-
getBy: ['getByLabelText'],
|
|
45
|
-
getAllBy: ['getAllByLabelText'],
|
|
46
|
-
queryBy: ['queryByLabelText'],
|
|
47
|
-
queryAllBy: ['queryAllByLabelText'],
|
|
48
|
-
findBy: ['findByLabelText'],
|
|
49
|
-
findAllBy: ['findAllByLabelText']
|
|
50
|
-
}, matchStringValue)(instance),
|
|
51
|
-
...(0, _makeA11yQuery.default)('accessibilityHint', {
|
|
52
|
-
getBy: ['getByA11yHint', 'getByAccessibilityHint', 'getByHintText'],
|
|
53
|
-
getAllBy: ['getAllByA11yHint', 'getAllByAccessibilityHint', 'getAllByHintText'],
|
|
54
|
-
queryBy: ['queryByA11yHint', 'queryByAccessibilityHint', 'queryByHintText'],
|
|
55
|
-
queryAllBy: ['queryAllByA11yHint', 'queryAllByAccessibilityHint', 'queryAllByHintText'],
|
|
56
|
-
findBy: ['findByA11yHint', 'findByAccessibilityHint', 'findByHintText'],
|
|
57
|
-
findAllBy: ['findAllByA11yHint', 'findAllByAccessibilityHint', 'findAllByHintText']
|
|
58
|
-
}, matchStringValue)(instance),
|
|
59
|
-
...(0, _makeA11yQuery.default)('accessibilityRole', {
|
|
60
|
-
getBy: ['getByRole'],
|
|
61
|
-
getAllBy: ['getAllByRole'],
|
|
62
|
-
queryBy: ['queryByRole'],
|
|
63
|
-
queryAllBy: ['queryAllByRole'],
|
|
64
|
-
findBy: ['findByRole'],
|
|
65
|
-
findAllBy: ['findAllByRole']
|
|
66
|
-
}, matchStringValue)(instance),
|
|
67
|
-
...(0, _makeA11yQuery.default)('accessibilityStates', {
|
|
68
|
-
getBy: ['getByA11yStates', 'getByAccessibilityStates'],
|
|
69
|
-
getAllBy: ['getAllByA11yStates', 'getAllByAccessibilityStates'],
|
|
70
|
-
queryBy: ['queryByA11yStates', 'queryByAccessibilityStates'],
|
|
71
|
-
queryAllBy: ['queryAllByA11yStates', 'queryAllByAccessibilityStates'],
|
|
72
|
-
findBy: ['findByA11yStates', 'findByAccessibilityStates'],
|
|
73
|
-
findAllBy: ['findAllByA11yStates', 'findAllByAccessibilityStates']
|
|
74
|
-
}, matchArrayValue)(instance),
|
|
75
|
-
...(0, _makeA11yQuery.default)('accessibilityState', {
|
|
76
|
-
getBy: ['getByA11yState', 'getByAccessibilityState'],
|
|
77
|
-
getAllBy: ['getAllByA11yState', 'getAllByAccessibilityState'],
|
|
78
|
-
queryBy: ['queryByA11yState', 'queryByAccessibilityState'],
|
|
79
|
-
queryAllBy: ['queryAllByA11yState', 'queryAllByAccessibilityState'],
|
|
80
|
-
findBy: ['findByA11yState', 'findByAccessibilityState'],
|
|
81
|
-
findAllBy: ['findAllByA11yState', 'findAllByAccessibilityState']
|
|
82
|
-
}, matchObject)(instance),
|
|
83
|
-
...(0, _makeA11yQuery.default)('accessibilityValue', {
|
|
84
|
-
getBy: ['getByA11yValue', 'getByAccessibilityValue'],
|
|
85
|
-
getAllBy: ['getAllByA11yValue', 'getAllByAccessibilityValue'],
|
|
86
|
-
queryBy: ['queryByA11yValue', 'queryByAccessibilityValue'],
|
|
87
|
-
queryAllBy: ['queryAllByA11yValue', 'queryAllByAccessibilityValue'],
|
|
88
|
-
findBy: ['findByA11yValue', 'findByAccessibilityValue'],
|
|
89
|
-
findAllBy: ['findAllByA11yValue', 'findAllByAccessibilityValue']
|
|
90
|
-
}, matchObject)(instance)
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
exports.a11yAPI = a11yAPI;
|
|
94
|
-
//# sourceMappingURL=a11yAPI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/queries/a11yAPI.ts"],"names":["matchStringValue","prop","matcher","Boolean","match","matchArrayValue","length","includes","some","e","matchObject","Object","keys","key","a11yAPI","instance","getBy","getAllBy","queryBy","queryAllBy","findBy","findAllBy"],"mappings":"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","sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport type { AccessibilityRole, AccessibilityState } from 'react-native';\nimport type { WaitForOptions } from '../waitFor';\nimport type { TextMatch } from '../matches';\nimport makeA11yQuery from './makeA11yQuery';\n\ntype AccessibilityStateKey = keyof AccessibilityState;\ntype A11yValue = {\n min?: number;\n max?: number;\n now?: number;\n text?: string;\n};\n\ntype GetReturn = ReactTestInstance;\ntype GetAllReturn = Array<ReactTestInstance>;\ntype QueryReturn = ReactTestInstance | null;\ntype QueryAllReturn = Array<ReactTestInstance>;\ntype FindReturn = Promise<GetReturn>;\ntype FindAllReturn = Promise<GetAllReturn>;\n\nexport type A11yAPI = {\n // Label\n getByLabelText: (label: TextMatch) => GetReturn;\n getAllByLabelText: (label: TextMatch) => GetAllReturn;\n queryByLabelText: (label: TextMatch) => QueryReturn;\n queryAllByLabelText: (label: TextMatch) => QueryAllReturn;\n findByLabelText: (\n label: TextMatch,\n waitForOptions?: WaitForOptions\n ) => FindReturn;\n findAllByLabelText: (\n label: TextMatch,\n waitForOptions?: WaitForOptions\n ) => FindAllReturn;\n\n // Hint\n getByA11yHint: (a11yHint: TextMatch) => GetReturn;\n getByHintText: (a11yHint: TextMatch) => GetReturn;\n getAllByA11yHint: (a11yHint: TextMatch) => GetAllReturn;\n getAllByHintText: (a11yHint: TextMatch) => GetAllReturn;\n queryByA11yHint: (a11yHint: TextMatch) => QueryReturn;\n queryByHintText: (a11yHint: TextMatch) => QueryReturn;\n queryAllByA11yHint: (a11yHint: TextMatch) => QueryAllReturn;\n queryAllByHintText: (a11yHint: TextMatch) => QueryAllReturn;\n findByA11yHint: (\n a11yHint: TextMatch,\n waitForOptions?: WaitForOptions\n ) => FindReturn;\n findByHintText: (\n a11yHint: TextMatch,\n waitForOptions?: WaitForOptions\n ) => FindReturn;\n findAllByA11yHint: (\n a11yHint: TextMatch,\n waitForOptions?: WaitForOptions\n ) => FindAllReturn;\n findAllByHintText: (\n a11yHint: TextMatch,\n waitForOptions?: WaitForOptions\n ) => FindAllReturn;\n\n // Role\n getByRole: (role: AccessibilityRole | RegExp) => GetReturn;\n getAllByRole: (role: AccessibilityRole | RegExp) => GetAllReturn;\n queryByRole: (role: AccessibilityRole | RegExp) => QueryReturn;\n queryAllByRole: (role: AccessibilityRole | RegExp) => QueryAllReturn;\n findByRole: (\n role: AccessibilityRole,\n waitForOptions?: WaitForOptions\n ) => FindReturn;\n findAllByRole: (\n role: AccessibilityRole,\n waitForOptions?: WaitForOptions\n ) => FindAllReturn;\n\n // States\n getByA11yStates: (\n accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>\n ) => GetReturn;\n getAllByA11yStates: (\n accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>\n ) => GetAllReturn;\n queryByA11yStates: (\n accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>\n ) => QueryReturn;\n queryAllByA11yStates: (\n accessibilityStateKey: AccessibilityStateKey | Array<AccessibilityStateKey>\n ) => QueryAllReturn;\n findByA11yStates: (\n accessibilityStateKey: AccessibilityStateKey,\n waitForOptions?: WaitForOptions\n ) => FindReturn;\n findAllByA11yStates: (\n accessibilityStateKey: AccessibilityStateKey,\n waitForOptions?: WaitForOptions\n ) => FindAllReturn;\n\n // State\n getByA11yState: (accessibilityState: AccessibilityState) => GetReturn;\n getAllByA11yState: (accessibilityState: AccessibilityState) => GetAllReturn;\n queryByA11yState: (accessibilityState: AccessibilityState) => QueryReturn;\n queryAllByA11yState: (\n accessibilityState: AccessibilityState\n ) => QueryAllReturn;\n findByA11yState: (\n accessibilityState: AccessibilityState,\n waitForOptions?: WaitForOptions\n ) => FindReturn;\n findAllByA11yState: (\n accessibilityState: AccessibilityState,\n waitForOptions?: WaitForOptions\n ) => FindAllReturn;\n\n // Value\n getByA11yValue: (a11yValue: A11yValue) => GetReturn;\n getAllByA11yValue: (a11yValue: A11yValue) => GetAllReturn;\n queryByA11yValue: (a11yValue: A11yValue) => QueryReturn;\n queryAllByA11yValue: (a11yValue: A11yValue) => QueryAllReturn;\n findByA11yValue: (\n a11yValue: A11yValue,\n waitForOptions?: WaitForOptions\n ) => FindReturn;\n findAllByA11yValue: (\n a11yValue: A11yValue,\n waitForOptions?: WaitForOptions\n ) => FindAllReturn;\n};\n\nexport function matchStringValue(\n prop: string | undefined,\n matcher: TextMatch\n): boolean {\n if (!prop) {\n return false;\n }\n\n if (typeof matcher === 'string') {\n return prop === matcher;\n }\n\n return Boolean(prop.match(matcher));\n}\n\nexport function matchArrayValue(\n prop: Array<string> | undefined,\n matcher: string | Array<string>\n): boolean {\n if (!prop || matcher.length === 0) {\n return false;\n }\n\n if (typeof matcher === 'string') {\n return prop.includes(matcher);\n }\n\n return !matcher.some((e) => !prop.includes(e));\n}\n\nexport function matchObject<T extends Record<string, unknown>>(\n prop: T | undefined,\n matcher: T\n): boolean {\n return prop\n ? Object.keys(matcher).length !== 0 &&\n Object.keys(prop).length !== 0 &&\n !Object.keys(matcher).some((key) => prop[key] !== matcher[key])\n : false;\n}\n\nexport const a11yAPI = (instance: ReactTestInstance): A11yAPI =>\n ({\n ...makeA11yQuery(\n 'accessibilityLabel',\n {\n getBy: ['getByLabelText'],\n getAllBy: ['getAllByLabelText'],\n queryBy: ['queryByLabelText'],\n queryAllBy: ['queryAllByLabelText'],\n findBy: ['findByLabelText'],\n findAllBy: ['findAllByLabelText'],\n },\n matchStringValue\n )(instance),\n ...makeA11yQuery(\n 'accessibilityHint',\n {\n getBy: ['getByA11yHint', 'getByAccessibilityHint', 'getByHintText'],\n getAllBy: [\n 'getAllByA11yHint',\n 'getAllByAccessibilityHint',\n 'getAllByHintText',\n ],\n queryBy: [\n 'queryByA11yHint',\n 'queryByAccessibilityHint',\n 'queryByHintText',\n ],\n queryAllBy: [\n 'queryAllByA11yHint',\n 'queryAllByAccessibilityHint',\n 'queryAllByHintText',\n ],\n findBy: ['findByA11yHint', 'findByAccessibilityHint', 'findByHintText'],\n findAllBy: [\n 'findAllByA11yHint',\n 'findAllByAccessibilityHint',\n 'findAllByHintText',\n ],\n },\n matchStringValue\n )(instance),\n ...makeA11yQuery(\n 'accessibilityRole',\n {\n getBy: ['getByRole'],\n getAllBy: ['getAllByRole'],\n queryBy: ['queryByRole'],\n queryAllBy: ['queryAllByRole'],\n findBy: ['findByRole'],\n findAllBy: ['findAllByRole'],\n },\n matchStringValue\n )(instance),\n ...makeA11yQuery(\n 'accessibilityStates',\n {\n getBy: ['getByA11yStates', 'getByAccessibilityStates'],\n getAllBy: ['getAllByA11yStates', 'getAllByAccessibilityStates'],\n queryBy: ['queryByA11yStates', 'queryByAccessibilityStates'],\n queryAllBy: ['queryAllByA11yStates', 'queryAllByAccessibilityStates'],\n findBy: ['findByA11yStates', 'findByAccessibilityStates'],\n findAllBy: ['findAllByA11yStates', 'findAllByAccessibilityStates'],\n },\n matchArrayValue\n )(instance),\n ...makeA11yQuery(\n 'accessibilityState',\n {\n getBy: ['getByA11yState', 'getByAccessibilityState'],\n getAllBy: ['getAllByA11yState', 'getAllByAccessibilityState'],\n queryBy: ['queryByA11yState', 'queryByAccessibilityState'],\n queryAllBy: ['queryAllByA11yState', 'queryAllByAccessibilityState'],\n findBy: ['findByA11yState', 'findByAccessibilityState'],\n findAllBy: ['findAllByA11yState', 'findAllByAccessibilityState'],\n },\n matchObject\n )(instance),\n ...makeA11yQuery(\n 'accessibilityValue',\n {\n getBy: ['getByA11yValue', 'getByAccessibilityValue'],\n getAllBy: ['getAllByA11yValue', 'getAllByAccessibilityValue'],\n queryBy: ['queryByA11yValue', 'queryByAccessibilityValue'],\n queryAllBy: ['queryAllByA11yValue', 'queryAllByAccessibilityValue'],\n findBy: ['findByA11yValue', 'findByAccessibilityValue'],\n findAllBy: ['findAllByA11yValue', 'findAllByAccessibilityValue'],\n },\n matchObject\n )(instance),\n } as any);\n"],"file":"a11yAPI.js"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ReactTestInstance } from 'react-test-renderer';
|
|
2
|
-
declare type QueryNames = {
|
|
3
|
-
getBy: Array<string>;
|
|
4
|
-
getAllBy: Array<string>;
|
|
5
|
-
queryBy: Array<string>;
|
|
6
|
-
queryAllBy: Array<string>;
|
|
7
|
-
findBy: Array<string>;
|
|
8
|
-
findAllBy: Array<string>;
|
|
9
|
-
};
|
|
10
|
-
declare const makeA11yQuery: <P extends unknown, M extends unknown>(name: string, queryNames: QueryNames, matcherFn: (prop: P, value: M) => boolean) => (instance: ReactTestInstance) => {
|
|
11
|
-
[x: string]: Function;
|
|
12
|
-
};
|
|
13
|
-
export default makeA11yQuery;
|