@testing-library/react-native 11.2.0 → 11.4.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.
Files changed (100) hide show
  1. package/README.md +3 -0
  2. package/build/act.js +9 -15
  3. package/build/act.js.map +1 -1
  4. package/build/cleanup.js +0 -4
  5. package/build/cleanup.js.map +1 -1
  6. package/build/config.d.ts +15 -0
  7. package/build/config.js +27 -0
  8. package/build/config.js.map +1 -0
  9. package/build/fireEvent.js +3 -33
  10. package/build/fireEvent.js.map +1 -1
  11. package/build/flushMicroTasks.js +0 -3
  12. package/build/flushMicroTasks.js.map +1 -1
  13. package/build/helpers/accessiblity.d.ts +3 -0
  14. package/build/helpers/accessiblity.js +14 -20
  15. package/build/helpers/accessiblity.js.map +1 -1
  16. package/build/helpers/component-tree.d.ts +15 -0
  17. package/build/helpers/component-tree.js +49 -15
  18. package/build/helpers/component-tree.js.map +1 -1
  19. package/build/helpers/debugDeep.d.ts +5 -1
  20. package/build/helpers/debugDeep.js +7 -6
  21. package/build/helpers/debugDeep.js.map +1 -1
  22. package/build/helpers/debugShallow.js +0 -5
  23. package/build/helpers/debugShallow.js.map +1 -1
  24. package/build/helpers/errors.js +4 -25
  25. package/build/helpers/errors.js.map +1 -1
  26. package/build/helpers/filterNodeByType.js +0 -2
  27. package/build/helpers/filterNodeByType.js.map +1 -1
  28. package/build/helpers/format.d.ts +5 -1
  29. package/build/helpers/format.js +17 -7
  30. package/build/helpers/format.js.map +1 -1
  31. package/build/helpers/matchers/accessibilityState.d.ts +3 -0
  32. package/build/helpers/matchers/accessibilityState.js +28 -0
  33. package/build/helpers/matchers/accessibilityState.js.map +1 -0
  34. package/build/helpers/matchers/matchArrayProp.js +0 -3
  35. package/build/helpers/matchers/matchArrayProp.js.map +1 -1
  36. package/build/helpers/matchers/matchObjectProp.js +0 -2
  37. package/build/helpers/matchers/matchObjectProp.js.map +1 -1
  38. package/build/helpers/matchers/matchStringProp.js +0 -3
  39. package/build/helpers/matchers/matchStringProp.js.map +1 -1
  40. package/build/helpers/stringValidation.js +0 -7
  41. package/build/helpers/stringValidation.js.map +1 -1
  42. package/build/helpers/timers.js +11 -22
  43. package/build/helpers/timers.js.map +1 -1
  44. package/build/index.flow.js +74 -21
  45. package/build/index.js +0 -6
  46. package/build/index.js.map +1 -1
  47. package/build/matches.js +2 -4
  48. package/build/matches.js.map +1 -1
  49. package/build/pure.d.ts +2 -0
  50. package/build/pure.js +13 -12
  51. package/build/pure.js.map +1 -1
  52. package/build/queries/a11yState.d.ts +1 -1
  53. package/build/queries/a11yState.js +15 -13
  54. package/build/queries/a11yState.js.map +1 -1
  55. package/build/queries/a11yValue.js +0 -8
  56. package/build/queries/a11yValue.js.map +1 -1
  57. package/build/queries/displayValue.js +7 -26
  58. package/build/queries/displayValue.js.map +1 -1
  59. package/build/queries/hintText.d.ts +19 -18
  60. package/build/queries/hintText.js +10 -11
  61. package/build/queries/hintText.js.map +1 -1
  62. package/build/queries/labelText.d.ts +7 -6
  63. package/build/queries/labelText.js +10 -11
  64. package/build/queries/labelText.js.map +1 -1
  65. package/build/queries/makeQueries.d.ts +3 -3
  66. package/build/queries/makeQueries.js +40 -24
  67. package/build/queries/makeQueries.js.map +1 -1
  68. package/build/queries/placeholderText.js +6 -25
  69. package/build/queries/placeholderText.js.map +1 -1
  70. package/build/queries/role.d.ts +3 -2
  71. package/build/queries/role.js +23 -13
  72. package/build/queries/role.js.map +1 -1
  73. package/build/queries/testId.js +0 -9
  74. package/build/queries/testId.js.map +1 -1
  75. package/build/queries/text.js +21 -45
  76. package/build/queries/text.js.map +1 -1
  77. package/build/queries/unsafeProps.js +2 -11
  78. package/build/queries/unsafeProps.js.map +1 -1
  79. package/build/queries/unsafeType.js +2 -9
  80. package/build/queries/unsafeType.js.map +1 -1
  81. package/build/react-versions.js +0 -4
  82. package/build/react-versions.js.map +1 -1
  83. package/build/render.d.ts +32 -31
  84. package/build/render.js +21 -31
  85. package/build/render.js.map +1 -1
  86. package/build/renderHook.js +2 -12
  87. package/build/renderHook.js.map +1 -1
  88. package/build/screen.js +0 -6
  89. package/build/screen.js.map +1 -1
  90. package/build/shallow.js +0 -6
  91. package/build/shallow.js.map +1 -1
  92. package/build/waitFor.js +31 -53
  93. package/build/waitFor.js.map +1 -1
  94. package/build/waitForElementToBeRemoved.js +2 -11
  95. package/build/waitForElementToBeRemoved.js.map +1 -1
  96. package/build/within.d.ts +30 -30
  97. package/build/within.js +2 -14
  98. package/build/within.js.map +1 -1
  99. package/package.json +18 -17
  100. package/typings/index.flow.js +74 -21
@@ -203,48 +203,82 @@ interface UnsafeByPropsQueries {
203
203
  | [];
204
204
  }
205
205
 
206
- interface ByRoleOptions {
207
- name?: string;
208
- }
206
+ type ByRoleOptions = {
207
+ ...A11yState,
208
+ name?: string,
209
+ };
209
210
 
210
211
  interface A11yAPI {
211
212
  // Label
212
- getByLabelText: (matcher: TextMatch) => GetReturn;
213
- getAllByLabelText: (matcher: TextMatch) => GetAllReturn;
214
- queryByLabelText: (matcher: TextMatch) => QueryReturn;
215
- queryAllByLabelText: (matcher: TextMatch) => QueryAllReturn;
213
+ getByLabelText: (matcher: TextMatch, options?: TextMatchOptions) => GetReturn;
214
+ getAllByLabelText: (
215
+ matcher: TextMatch,
216
+ options?: TextMatchOptions
217
+ ) => GetAllReturn;
218
+ queryByLabelText: (
219
+ matcher: TextMatch,
220
+ options?: TextMatchOptions
221
+ ) => QueryReturn;
222
+ queryAllByLabelText: (
223
+ matcher: TextMatch,
224
+ options?: TextMatchOptions
225
+ ) => QueryAllReturn;
216
226
  findByLabelText: (
217
227
  matcher: TextMatch,
228
+ queryOptions?: TextMatchOptions,
218
229
  waitForOptions?: WaitForOptions
219
230
  ) => FindReturn;
220
231
  findAllByLabelText: (
221
232
  matcher: TextMatch,
233
+ queryOptions?: TextMatchOptions,
222
234
  waitForOptions?: WaitForOptions
223
235
  ) => FindAllReturn;
224
236
 
225
237
  // Hint
226
- getByA11yHint: (matcher: TextMatch) => GetReturn;
227
- getByHintText: (matcher: TextMatch) => GetReturn;
228
- getAllByA11yHint: (matcher: TextMatch) => GetAllReturn;
229
- getAllByHintText: (matcher: TextMatch) => GetAllReturn;
230
- queryByA11yHint: (matcher: TextMatch) => QueryReturn;
231
- queryByHintText: (matcher: TextMatch) => QueryReturn;
232
- queryAllByA11yHint: (matcher: TextMatch) => QueryAllReturn;
233
- queryAllByHintText: (matcher: TextMatch) => QueryAllReturn;
238
+ getByA11yHint: (matcher: TextMatch, options?: TextMatchOptions) => GetReturn;
239
+ getByHintText: (matcher: TextMatch, options?: TextMatchOptions) => GetReturn;
240
+ getAllByA11yHint: (
241
+ matcher: TextMatch,
242
+ options?: TextMatchOptions
243
+ ) => GetAllReturn;
244
+ getAllByHintText: (
245
+ matcher: TextMatch,
246
+ options?: TextMatchOptions
247
+ ) => GetAllReturn;
248
+ queryByA11yHint: (
249
+ matcher: TextMatch,
250
+ options?: TextMatchOptions
251
+ ) => QueryReturn;
252
+ queryByHintText: (
253
+ matcher: TextMatch,
254
+ options?: TextMatchOptions
255
+ ) => QueryReturn;
256
+ queryAllByA11yHint: (
257
+ matcher: TextMatch,
258
+ options?: TextMatchOptions
259
+ ) => QueryAllReturn;
260
+ queryAllByHintText: (
261
+ matcher: TextMatch,
262
+ options?: TextMatchOptions
263
+ ) => QueryAllReturn;
234
264
  findByA11yHint: (
235
265
  matcher: TextMatch,
266
+ queryOptions?: TextMatchOptions,
236
267
  waitForOptions?: WaitForOptions
237
268
  ) => FindReturn;
238
269
  findByHintText: (
239
270
  matcher: TextMatch,
271
+ queryOptions?: TextMatchOptions,
240
272
  waitForOptions?: WaitForOptions
241
273
  ) => FindReturn;
242
274
  findAllByA11yHint: (
243
275
  matcher: TextMatch,
276
+ queryOptions?: TextMatchOptions,
244
277
  waitForOptions?: WaitForOptions
245
278
  ) => FindAllReturn;
246
279
  findAllByHintText: (
247
280
  matcher: TextMatch,
281
+ queryOptions?: TextMatchOptions,
248
282
  waitForOptions?: WaitForOptions
249
283
  ) => FindAllReturn;
250
284
 
@@ -252,24 +286,24 @@ interface A11yAPI {
252
286
  getByRole: (matcher: A11yRole | RegExp, role?: ByRoleOptions) => GetReturn;
253
287
  getAllByRole: (
254
288
  matcher: A11yRole | RegExp,
255
- role?: ByRoleOptions
289
+ options?: ByRoleOptions
256
290
  ) => GetAllReturn;
257
291
  queryByRole: (
258
292
  matcher: A11yRole | RegExp,
259
- role?: ByRoleOptions
293
+ options?: ByRoleOptions
260
294
  ) => QueryReturn;
261
295
  queryAllByRole: (
262
296
  matcher: A11yRole | RegExp,
263
- role?: ByRoleOptions
297
+ options?: ByRoleOptions
264
298
  ) => QueryAllReturn;
265
299
  findByRole: (
266
300
  matcher: A11yRole | RegExp,
267
- role?: ByRoleOptions,
301
+ queryOptions?: ByRoleOptions,
268
302
  waitForOptions?: WaitForOptions
269
303
  ) => FindReturn;
270
304
  findAllByRole: (
271
305
  matcher: A11yRole | RegExp,
272
- role?: ByRoleOptions,
306
+ queryOptions?: ByRoleOptions,
273
307
  waitForOptions?: WaitForOptions
274
308
  ) => FindAllReturn;
275
309
 
@@ -306,8 +340,18 @@ interface Thenable {
306
340
  then: (resolve: () => any, reject?: () => any) => any;
307
341
  }
308
342
 
343
+ type MapPropsFunction = (
344
+ props: { [string]: mixed },
345
+ node: ReactTestRendererJSON
346
+ ) => { [string]: mixed };
347
+
348
+ type DebugOptions = {
349
+ message?: string,
350
+ mapProps?: MapPropsFunction,
351
+ };
352
+
309
353
  type Debug = {
310
- (message?: string): void,
354
+ (options?: DebugOptions | string): void,
311
355
  shallow: (message?: string) => void,
312
356
  };
313
357
 
@@ -346,6 +390,7 @@ declare module '@testing-library/react-native' {
346
390
  declare interface RenderOptions {
347
391
  wrapper?: React.ComponentType<any>;
348
392
  createNodeMock?: (element: React.Element<any>) => any;
393
+ unstable_validateStringsRenderedWithinText?: boolean;
349
394
  }
350
395
 
351
396
  declare export var render: (
@@ -367,6 +412,14 @@ declare module '@testing-library/react-native' {
367
412
 
368
413
  declare export var waitForElementToBeRemoved: WaitForElementToBeRemovedFunction;
369
414
 
415
+ declare interface Config {
416
+ asyncUtilTimeout: number;
417
+ defaultDebugOptions?: $Shape<DebugOptions>;
418
+ }
419
+
420
+ declare export var configure: (options: $Shape<Config>) => void;
421
+ declare export var resetToDefaults: () => void;
422
+
370
423
  declare export var act: (callback: () => void) => Thenable;
371
424
  declare export var within: (instance: ReactTestInstance) => Queries;
372
425
  declare export var getQueriesForElement: (