@testing-library/react-native 11.4.0 → 11.5.1
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/act.d.ts +3 -1
- package/build/act.js +1 -13
- package/build/act.js.map +1 -1
- package/build/cleanup.d.ts +1 -1
- package/build/config.d.ts +31 -2
- package/build/config.js +28 -3
- package/build/config.js.map +1 -1
- package/build/fireEvent.js +3 -3
- package/build/fireEvent.js.map +1 -1
- package/build/flushMicroTasks.d.ts +1 -1
- package/build/helpers/accessiblity.d.ts +11 -4
- package/build/helpers/accessiblity.js +29 -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/host-component-names.d.ts +2 -0
- package/build/helpers/host-component-names.js +50 -0
- package/build/helpers/host-component-names.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/matchLabelText.d.ts +3 -0
- package/build/helpers/matchers/matchLabelText.js +26 -0
- package/build/helpers/matchers/matchLabelText.js.map +1 -0
- package/build/helpers/matchers/matchTextContent.d.ts +10 -0
- package/build/helpers/matchers/matchTextContent.js +24 -0
- package/build/helpers/matchers/matchTextContent.js.map +1 -0
- package/build/helpers/timers.d.ts +0 -2
- package/build/helpers/timers.js.map +1 -1
- package/build/index.flow.js +123 -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 +7 -2
- 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 +7 -11
- 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 +8 -3
- package/build/queries/placeholderText.js.map +1 -1
- package/build/queries/role.d.ts +7 -4
- package/build/queries/role.js +22 -11
- package/build/queries/role.js.map +1 -1
- package/build/queries/testId.d.ts +11 -9
- package/build/queries/testId.js +2 -2
- package/build/queries/testId.js.map +1 -1
- package/build/queries/text.d.ts +11 -13
- package/build/queries/text.js +24 -51
- 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 +17 -18
- package/typings/index.flow.js +123 -54
package/typings/index.flow.js
CHANGED
|
@@ -8,6 +8,11 @@ type QueryAllReturn = Array<ReactTestInstance> | [];
|
|
|
8
8
|
type FindReturn = Promise<ReactTestInstance>;
|
|
9
9
|
type FindAllReturn = Promise<ReactTestInstance[]>;
|
|
10
10
|
|
|
11
|
+
type CommonQueryOptions = {
|
|
12
|
+
includeHiddenElements?: boolean,
|
|
13
|
+
hidden?: boolean,
|
|
14
|
+
};
|
|
15
|
+
|
|
11
16
|
type TextMatch = string | RegExp;
|
|
12
17
|
|
|
13
18
|
declare type NormalizerFn = (textToNormalize: string) => string;
|
|
@@ -60,7 +65,7 @@ declare type A11yValue = {
|
|
|
60
65
|
min?: number,
|
|
61
66
|
max?: number,
|
|
62
67
|
now?: number,
|
|
63
|
-
text?:
|
|
68
|
+
text?: TextMatch,
|
|
64
69
|
};
|
|
65
70
|
|
|
66
71
|
type WaitForOptions = {
|
|
@@ -74,109 +79,123 @@ type WaitForFunction = <T = any>(
|
|
|
74
79
|
options?: WaitForOptions
|
|
75
80
|
) => Promise<T>;
|
|
76
81
|
|
|
82
|
+
type ByTextOptions = CommonQueryOptions & TextMatchOptions;
|
|
83
|
+
|
|
77
84
|
interface ByTextQueries {
|
|
78
|
-
getByText: (text: TextMatch, options?:
|
|
85
|
+
getByText: (text: TextMatch, options?: ByTextOptions) => ReactTestInstance;
|
|
79
86
|
getAllByText: (
|
|
80
87
|
text: TextMatch,
|
|
81
|
-
options?:
|
|
88
|
+
options?: ByTextOptions
|
|
82
89
|
) => Array<ReactTestInstance>;
|
|
83
90
|
queryByText: (
|
|
84
91
|
name: TextMatch,
|
|
85
|
-
options?:
|
|
92
|
+
options?: ByTextOptions
|
|
86
93
|
) => ReactTestInstance | null;
|
|
87
94
|
queryAllByText: (
|
|
88
95
|
text: TextMatch,
|
|
89
|
-
options?:
|
|
96
|
+
options?: ByTextOptions
|
|
90
97
|
) => Array<ReactTestInstance> | [];
|
|
91
98
|
findByText: (
|
|
92
99
|
text: TextMatch,
|
|
93
|
-
queryOptions?:
|
|
100
|
+
queryOptions?: ByTextOptions,
|
|
94
101
|
waitForOptions?: WaitForOptions
|
|
95
102
|
) => FindReturn;
|
|
96
103
|
findAllByText: (
|
|
97
104
|
text: TextMatch,
|
|
98
|
-
queryOptions?:
|
|
105
|
+
queryOptions?: ByTextOptions,
|
|
99
106
|
waitForOptions?: WaitForOptions
|
|
100
107
|
) => FindAllReturn;
|
|
101
108
|
}
|
|
102
109
|
|
|
110
|
+
type ByTestIdOptions = CommonQueryOptions & TextMatchOptions;
|
|
111
|
+
|
|
103
112
|
interface ByTestIdQueries {
|
|
104
113
|
getByTestId: (
|
|
105
114
|
testID: TextMatch,
|
|
106
|
-
options?:
|
|
115
|
+
options?: ByTestIdOptions
|
|
107
116
|
) => ReactTestInstance;
|
|
108
117
|
getAllByTestId: (
|
|
109
118
|
testID: TextMatch,
|
|
110
|
-
options?:
|
|
119
|
+
options?: ByTestIdOptions
|
|
111
120
|
) => Array<ReactTestInstance>;
|
|
112
|
-
queryByTestId: (
|
|
113
|
-
|
|
121
|
+
queryByTestId: (
|
|
122
|
+
testID: TextMatch,
|
|
123
|
+
options?: ByTestIdOptions
|
|
124
|
+
) => ReactTestInstance | null;
|
|
125
|
+
queryAllByTestId: (
|
|
126
|
+
testID: TextMatch,
|
|
127
|
+
options?: ByTestIdOptions
|
|
128
|
+
) => Array<ReactTestInstance> | [];
|
|
114
129
|
findByTestId: (
|
|
115
130
|
testID: TextMatch,
|
|
116
|
-
queryOptions?:
|
|
131
|
+
queryOptions?: ByTestIdOptions,
|
|
117
132
|
waitForOptions?: WaitForOptions
|
|
118
133
|
) => FindReturn;
|
|
119
134
|
findAllByTestId: (
|
|
120
135
|
testID: TextMatch,
|
|
121
|
-
queryOptions?:
|
|
136
|
+
queryOptions?: ByTestIdOptions,
|
|
122
137
|
waitForOptions?: WaitForOptions
|
|
123
138
|
) => FindAllReturn;
|
|
124
139
|
}
|
|
125
140
|
|
|
141
|
+
type ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;
|
|
142
|
+
|
|
126
143
|
interface ByDisplayValueQueries {
|
|
127
144
|
getByDisplayValue: (
|
|
128
145
|
value: TextMatch,
|
|
129
|
-
options?:
|
|
146
|
+
options?: ByDisplayValueOptions
|
|
130
147
|
) => ReactTestInstance;
|
|
131
148
|
getAllByDisplayValue: (
|
|
132
149
|
value: TextMatch,
|
|
133
|
-
options?:
|
|
150
|
+
options?: ByDisplayValueOptions
|
|
134
151
|
) => Array<ReactTestInstance>;
|
|
135
152
|
queryByDisplayValue: (
|
|
136
153
|
value: TextMatch,
|
|
137
|
-
options?:
|
|
154
|
+
options?: ByDisplayValueOptions
|
|
138
155
|
) => ReactTestInstance | null;
|
|
139
156
|
queryAllByDisplayValue: (
|
|
140
157
|
value: TextMatch,
|
|
141
|
-
options?:
|
|
158
|
+
options?: ByDisplayValueOptions
|
|
142
159
|
) => Array<ReactTestInstance> | [];
|
|
143
160
|
findByDisplayValue: (
|
|
144
161
|
value: TextMatch,
|
|
145
|
-
queryOptions?:
|
|
162
|
+
queryOptions?: ByDisplayValueOptions,
|
|
146
163
|
waitForOptions?: WaitForOptions
|
|
147
164
|
) => FindReturn;
|
|
148
165
|
findAllByDisplayValue: (
|
|
149
166
|
value: TextMatch,
|
|
150
|
-
queryOptions?:
|
|
167
|
+
queryOptions?: ByDisplayValueOptions,
|
|
151
168
|
waitForOptions?: WaitForOptions
|
|
152
169
|
) => FindAllReturn;
|
|
153
170
|
}
|
|
154
171
|
|
|
172
|
+
type ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;
|
|
173
|
+
|
|
155
174
|
interface ByPlaceholderTextQueries {
|
|
156
175
|
getByPlaceholderText: (
|
|
157
176
|
placeholder: TextMatch,
|
|
158
|
-
options?:
|
|
177
|
+
options?: ByPlaceholderTextOptions
|
|
159
178
|
) => ReactTestInstance;
|
|
160
179
|
getAllByPlaceholderText: (
|
|
161
180
|
placeholder: TextMatch,
|
|
162
|
-
options?:
|
|
181
|
+
options?: ByPlaceholderTextOptions
|
|
163
182
|
) => Array<ReactTestInstance>;
|
|
164
183
|
queryByPlaceholderText: (
|
|
165
184
|
placeholder: TextMatch,
|
|
166
|
-
options?:
|
|
185
|
+
options?: ByPlaceholderTextOptions
|
|
167
186
|
) => ReactTestInstance | null;
|
|
168
187
|
queryAllByPlaceholderText: (
|
|
169
188
|
placeholder: TextMatch,
|
|
170
|
-
options?:
|
|
189
|
+
options?: ByPlaceholderTextOptions
|
|
171
190
|
) => Array<ReactTestInstance> | [];
|
|
172
191
|
findByPlaceholderText: (
|
|
173
192
|
placeholder: TextMatch,
|
|
174
|
-
queryOptions?:
|
|
193
|
+
queryOptions?: ByPlaceholderTextOptions,
|
|
175
194
|
waitForOptions?: WaitForOptions
|
|
176
195
|
) => FindReturn;
|
|
177
196
|
findAllByPlaceholderText: (
|
|
178
197
|
placeholder: TextMatch,
|
|
179
|
-
queryOptions?:
|
|
198
|
+
queryOptions?: ByPlaceholderTextOptions,
|
|
180
199
|
waitForOptions?: WaitForOptions
|
|
181
200
|
) => FindAllReturn;
|
|
182
201
|
}
|
|
@@ -203,82 +222,89 @@ interface UnsafeByPropsQueries {
|
|
|
203
222
|
| [];
|
|
204
223
|
}
|
|
205
224
|
|
|
206
|
-
type ByRoleOptions = {
|
|
225
|
+
type ByRoleOptions = CommonQueryOptions & {
|
|
207
226
|
...A11yState,
|
|
208
227
|
name?: string,
|
|
228
|
+
value?: A11yValue,
|
|
209
229
|
};
|
|
210
230
|
|
|
231
|
+
type ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;
|
|
232
|
+
type ByHintTextOptions = CommonQueryOptions & TextMatchOptions;
|
|
233
|
+
|
|
211
234
|
interface A11yAPI {
|
|
212
235
|
// Label
|
|
213
|
-
getByLabelText: (
|
|
236
|
+
getByLabelText: (
|
|
237
|
+
matcher: TextMatch,
|
|
238
|
+
options?: ByLabelTextOptions
|
|
239
|
+
) => GetReturn;
|
|
214
240
|
getAllByLabelText: (
|
|
215
241
|
matcher: TextMatch,
|
|
216
|
-
options?:
|
|
242
|
+
options?: ByLabelTextOptions
|
|
217
243
|
) => GetAllReturn;
|
|
218
244
|
queryByLabelText: (
|
|
219
245
|
matcher: TextMatch,
|
|
220
|
-
options?:
|
|
246
|
+
options?: ByLabelTextOptions
|
|
221
247
|
) => QueryReturn;
|
|
222
248
|
queryAllByLabelText: (
|
|
223
249
|
matcher: TextMatch,
|
|
224
|
-
options?:
|
|
250
|
+
options?: ByLabelTextOptions
|
|
225
251
|
) => QueryAllReturn;
|
|
226
252
|
findByLabelText: (
|
|
227
253
|
matcher: TextMatch,
|
|
228
|
-
queryOptions?:
|
|
254
|
+
queryOptions?: ByLabelTextOptions,
|
|
229
255
|
waitForOptions?: WaitForOptions
|
|
230
256
|
) => FindReturn;
|
|
231
257
|
findAllByLabelText: (
|
|
232
258
|
matcher: TextMatch,
|
|
233
|
-
queryOptions?:
|
|
259
|
+
queryOptions?: ByLabelTextOptions,
|
|
234
260
|
waitForOptions?: WaitForOptions
|
|
235
261
|
) => FindAllReturn;
|
|
236
262
|
|
|
237
263
|
// Hint
|
|
238
|
-
getByA11yHint: (matcher: TextMatch, options?:
|
|
239
|
-
getByHintText: (matcher: TextMatch, options?:
|
|
264
|
+
getByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => GetReturn;
|
|
265
|
+
getByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => GetReturn;
|
|
240
266
|
getAllByA11yHint: (
|
|
241
267
|
matcher: TextMatch,
|
|
242
|
-
options?:
|
|
268
|
+
options?: ByHintTextOptions
|
|
243
269
|
) => GetAllReturn;
|
|
244
270
|
getAllByHintText: (
|
|
245
271
|
matcher: TextMatch,
|
|
246
|
-
options?:
|
|
272
|
+
options?: ByHintTextOptions
|
|
247
273
|
) => GetAllReturn;
|
|
248
274
|
queryByA11yHint: (
|
|
249
275
|
matcher: TextMatch,
|
|
250
|
-
options?:
|
|
276
|
+
options?: ByHintTextOptions
|
|
251
277
|
) => QueryReturn;
|
|
252
278
|
queryByHintText: (
|
|
253
279
|
matcher: TextMatch,
|
|
254
|
-
options?:
|
|
280
|
+
options?: ByHintTextOptions
|
|
255
281
|
) => QueryReturn;
|
|
256
282
|
queryAllByA11yHint: (
|
|
257
283
|
matcher: TextMatch,
|
|
258
|
-
options?:
|
|
284
|
+
options?: ByHintTextOptions
|
|
259
285
|
) => QueryAllReturn;
|
|
260
286
|
queryAllByHintText: (
|
|
261
287
|
matcher: TextMatch,
|
|
262
|
-
options?:
|
|
288
|
+
options?: ByHintTextOptions
|
|
263
289
|
) => QueryAllReturn;
|
|
264
290
|
findByA11yHint: (
|
|
265
291
|
matcher: TextMatch,
|
|
266
|
-
queryOptions?:
|
|
292
|
+
queryOptions?: ByHintTextOptions,
|
|
267
293
|
waitForOptions?: WaitForOptions
|
|
268
294
|
) => FindReturn;
|
|
269
295
|
findByHintText: (
|
|
270
296
|
matcher: TextMatch,
|
|
271
|
-
queryOptions?:
|
|
297
|
+
queryOptions?: ByHintTextOptions,
|
|
272
298
|
waitForOptions?: WaitForOptions
|
|
273
299
|
) => FindReturn;
|
|
274
300
|
findAllByA11yHint: (
|
|
275
301
|
matcher: TextMatch,
|
|
276
|
-
queryOptions?:
|
|
302
|
+
queryOptions?: ByHintTextOptions,
|
|
277
303
|
waitForOptions?: WaitForOptions
|
|
278
304
|
) => FindAllReturn;
|
|
279
305
|
findAllByHintText: (
|
|
280
306
|
matcher: TextMatch,
|
|
281
|
-
queryOptions?:
|
|
307
|
+
queryOptions?: ByHintTextOptions,
|
|
282
308
|
waitForOptions?: WaitForOptions
|
|
283
309
|
) => FindAllReturn;
|
|
284
310
|
|
|
@@ -308,30 +334,58 @@ interface A11yAPI {
|
|
|
308
334
|
) => FindAllReturn;
|
|
309
335
|
|
|
310
336
|
// State
|
|
311
|
-
getByA11yState: (
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
337
|
+
getByA11yState: (
|
|
338
|
+
matcher: A11yState,
|
|
339
|
+
options?: CommonQueryOptions
|
|
340
|
+
) => GetReturn;
|
|
341
|
+
getAllByA11yState: (
|
|
342
|
+
matcher: A11yState,
|
|
343
|
+
options?: CommonQueryOptions
|
|
344
|
+
) => GetAllReturn;
|
|
345
|
+
queryByA11yState: (
|
|
346
|
+
matcher: A11yState,
|
|
347
|
+
options?: CommonQueryOptions
|
|
348
|
+
) => QueryReturn;
|
|
349
|
+
queryAllByA11yState: (
|
|
350
|
+
matcher: A11yState,
|
|
351
|
+
options?: CommonQueryOptions
|
|
352
|
+
) => QueryAllReturn;
|
|
315
353
|
findByA11yState: (
|
|
316
354
|
matcher: A11yState,
|
|
355
|
+
queryOptions?: CommonQueryOptions,
|
|
317
356
|
waitForOptions?: WaitForOptions
|
|
318
357
|
) => FindReturn;
|
|
319
358
|
findAllByA11yState: (
|
|
320
359
|
matcher: A11yState,
|
|
360
|
+
queryOptions?: CommonQueryOptions,
|
|
321
361
|
waitForOptions?: WaitForOptions
|
|
322
362
|
) => FindAllReturn;
|
|
323
363
|
|
|
324
364
|
// Value
|
|
325
|
-
getByA11yValue: (
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
365
|
+
getByA11yValue: (
|
|
366
|
+
matcher: A11yValue,
|
|
367
|
+
options?: CommonQueryOptions
|
|
368
|
+
) => GetReturn;
|
|
369
|
+
getAllByA11yValue: (
|
|
370
|
+
matcher: A11yValue,
|
|
371
|
+
options?: CommonQueryOptions
|
|
372
|
+
) => GetAllReturn;
|
|
373
|
+
queryByA11yValue: (
|
|
374
|
+
matcher: A11yValue,
|
|
375
|
+
options?: CommonQueryOptions
|
|
376
|
+
) => QueryReturn;
|
|
377
|
+
queryAllByA11yValue: (
|
|
378
|
+
matcher: A11yValue,
|
|
379
|
+
options?: CommonQueryOptions
|
|
380
|
+
) => QueryAllReturn;
|
|
329
381
|
findByA11yValue: (
|
|
330
382
|
matcher: A11yValue,
|
|
383
|
+
queryOptions?: CommonQueryOptions,
|
|
331
384
|
waitForOptions?: WaitForOptions
|
|
332
385
|
) => FindReturn;
|
|
333
386
|
findAllByA11yValue: (
|
|
334
387
|
matcher: A11yValue,
|
|
388
|
+
queryOptions?: CommonQueryOptions,
|
|
335
389
|
waitForOptions?: WaitForOptions
|
|
336
390
|
) => FindAllReturn;
|
|
337
391
|
}
|
|
@@ -414,22 +468,37 @@ declare module '@testing-library/react-native' {
|
|
|
414
468
|
|
|
415
469
|
declare interface Config {
|
|
416
470
|
asyncUtilTimeout: number;
|
|
471
|
+
defaultIncludeHiddenElements: boolean;
|
|
417
472
|
defaultDebugOptions?: $Shape<DebugOptions>;
|
|
418
473
|
}
|
|
419
474
|
|
|
420
|
-
declare
|
|
475
|
+
declare interface ConfigAliasOptions {
|
|
476
|
+
/** Alias to `defaultIncludeHiddenElements` for RTL compatibility */
|
|
477
|
+
defaultHidden: boolean;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
declare export var configure: (
|
|
481
|
+
options: $Shape<Config & ConfigAliasOptions>
|
|
482
|
+
) => void;
|
|
421
483
|
declare export var resetToDefaults: () => void;
|
|
422
484
|
|
|
423
485
|
declare export var act: (callback: () => void) => Thenable;
|
|
424
486
|
declare export var within: (instance: ReactTestInstance) => Queries;
|
|
425
487
|
declare export var getQueriesForElement: (
|
|
426
|
-
|
|
488
|
+
element: ReactTestInstance
|
|
427
489
|
) => Queries;
|
|
428
490
|
|
|
429
491
|
declare export var getDefaultNormalizer: (
|
|
430
492
|
normalizerConfig?: NormalizerConfig
|
|
431
493
|
) => NormalizerFn;
|
|
432
494
|
|
|
495
|
+
declare export var isHiddenFromAccessibility: (
|
|
496
|
+
element: ReactTestInstance | null
|
|
497
|
+
) => boolean;
|
|
498
|
+
declare export var isInaccessible: (
|
|
499
|
+
element: ReactTestInstance | null
|
|
500
|
+
) => boolean;
|
|
501
|
+
|
|
433
502
|
declare type RenderHookResult<Result, Props> = {
|
|
434
503
|
rerender: (props: Props) => void,
|
|
435
504
|
result: { current: Result },
|