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