@testing-library/react-native 14.0.0-alpha.4 → 14.0.0-alpha.6

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 (148) hide show
  1. package/README.md +2 -2
  2. package/build/act.d.ts +1 -4
  3. package/build/act.js +5 -3
  4. package/build/act.js.map +1 -1
  5. package/build/cleanup.d.ts +3 -5
  6. package/build/cleanup.js +2 -8
  7. package/build/cleanup.js.map +1 -1
  8. package/build/fire-event.d.ts +3 -10
  9. package/build/fire-event.js +7 -29
  10. package/build/fire-event.js.map +1 -1
  11. package/build/helpers/accessibility.d.ts +1 -1
  12. package/build/helpers/accessibility.js.map +1 -1
  13. package/build/helpers/component-tree.d.ts +1 -1
  14. package/build/helpers/component-tree.js.map +1 -1
  15. package/build/helpers/debug.d.ts +1 -1
  16. package/build/helpers/debug.js.map +1 -1
  17. package/build/helpers/find-all.d.ts +1 -1
  18. package/build/helpers/find-all.js.map +1 -1
  19. package/build/helpers/format-element.d.ts +1 -1
  20. package/build/helpers/format-element.js.map +1 -1
  21. package/build/helpers/host-component-names.d.ts +2 -1
  22. package/build/helpers/host-component-names.js +2 -1
  23. package/build/helpers/host-component-names.js.map +1 -1
  24. package/build/helpers/matchers/match-accessibility-state.d.ts +1 -1
  25. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  26. package/build/helpers/matchers/match-accessibility-value.d.ts +1 -1
  27. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  28. package/build/helpers/matchers/match-label-text.d.ts +1 -1
  29. package/build/helpers/matchers/match-label-text.js.map +1 -1
  30. package/build/helpers/matchers/match-text-content.d.ts +1 -1
  31. package/build/helpers/matchers/match-text-content.js.map +1 -1
  32. package/build/helpers/pointer-events.d.ts +1 -1
  33. package/build/helpers/pointer-events.js.map +1 -1
  34. package/build/helpers/text-content.d.ts +1 -1
  35. package/build/helpers/text-content.js.map +1 -1
  36. package/build/helpers/text-input.d.ts +1 -1
  37. package/build/helpers/text-input.js.map +1 -1
  38. package/build/helpers/timers.d.ts +3 -1
  39. package/build/helpers/timers.js +3 -1
  40. package/build/helpers/timers.js.map +1 -1
  41. package/build/index.js +1 -1
  42. package/build/index.js.map +1 -1
  43. package/build/matchers/to-be-busy.d.ts +1 -1
  44. package/build/matchers/to-be-busy.js.map +1 -1
  45. package/build/matchers/to-be-checked.d.ts +1 -1
  46. package/build/matchers/to-be-checked.js.map +1 -1
  47. package/build/matchers/to-be-disabled.d.ts +1 -1
  48. package/build/matchers/to-be-disabled.js.map +1 -1
  49. package/build/matchers/to-be-empty-element.d.ts +1 -1
  50. package/build/matchers/to-be-empty-element.js.map +1 -1
  51. package/build/matchers/to-be-expanded.d.ts +1 -1
  52. package/build/matchers/to-be-expanded.js.map +1 -1
  53. package/build/matchers/to-be-on-the-screen.d.ts +1 -1
  54. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  55. package/build/matchers/to-be-partially-checked.d.ts +1 -1
  56. package/build/matchers/to-be-partially-checked.js.map +1 -1
  57. package/build/matchers/to-be-selected.d.ts +1 -1
  58. package/build/matchers/to-be-selected.js.map +1 -1
  59. package/build/matchers/to-be-visible.d.ts +1 -1
  60. package/build/matchers/to-be-visible.js.map +1 -1
  61. package/build/matchers/to-contain-element.d.ts +1 -1
  62. package/build/matchers/to-contain-element.js.map +1 -1
  63. package/build/matchers/to-have-accessibility-value.d.ts +1 -1
  64. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  65. package/build/matchers/to-have-accessible-name.d.ts +1 -1
  66. package/build/matchers/to-have-accessible-name.js.map +1 -1
  67. package/build/matchers/to-have-display-value.d.ts +1 -1
  68. package/build/matchers/to-have-display-value.js.map +1 -1
  69. package/build/matchers/to-have-prop.d.ts +1 -1
  70. package/build/matchers/to-have-prop.js.map +1 -1
  71. package/build/matchers/to-have-style.d.ts +1 -1
  72. package/build/matchers/to-have-style.js.map +1 -1
  73. package/build/matchers/to-have-text-content.d.ts +1 -1
  74. package/build/matchers/to-have-text-content.js.map +1 -1
  75. package/build/matchers/types.d.ts +1 -1
  76. package/build/matchers/types.js.map +1 -1
  77. package/build/matchers/utils.d.ts +1 -1
  78. package/build/matchers/utils.js.map +1 -1
  79. package/build/native-state.d.ts +1 -1
  80. package/build/native-state.js.map +1 -1
  81. package/build/pure.d.ts +10 -12
  82. package/build/pure.js +12 -45
  83. package/build/pure.js.map +1 -1
  84. package/build/queries/display-value.d.ts +1 -1
  85. package/build/queries/display-value.js.map +1 -1
  86. package/build/queries/hint-text.d.ts +1 -1
  87. package/build/queries/hint-text.js.map +1 -1
  88. package/build/queries/label-text.d.ts +1 -1
  89. package/build/queries/label-text.js.map +1 -1
  90. package/build/queries/make-queries.d.ts +1 -1
  91. package/build/queries/make-queries.js +3 -4
  92. package/build/queries/make-queries.js.map +1 -1
  93. package/build/queries/placeholder-text.d.ts +1 -1
  94. package/build/queries/placeholder-text.js.map +1 -1
  95. package/build/queries/role.d.ts +1 -1
  96. package/build/queries/role.js.map +1 -1
  97. package/build/queries/test-id.d.ts +1 -1
  98. package/build/queries/test-id.js.map +1 -1
  99. package/build/queries/text.d.ts +1 -1
  100. package/build/queries/text.js.map +1 -1
  101. package/build/render-hook.d.ts +0 -8
  102. package/build/render-hook.js +3 -42
  103. package/build/render-hook.js.map +1 -1
  104. package/build/render.d.ts +7 -77
  105. package/build/render.js +26 -42
  106. package/build/render.js.map +1 -1
  107. package/build/screen.js +1 -5
  108. package/build/screen.js.map +1 -1
  109. package/build/test-utils/json.d.ts +1 -1
  110. package/build/test-utils/json.js.map +1 -1
  111. package/build/tsconfig.release.tsbuildinfo +1 -1
  112. package/build/types.js +4 -0
  113. package/build/user-event/clear.d.ts +1 -1
  114. package/build/user-event/clear.js.map +1 -1
  115. package/build/user-event/index.d.ts +1 -1
  116. package/build/user-event/index.js.map +1 -1
  117. package/build/user-event/paste.d.ts +1 -1
  118. package/build/user-event/paste.js.map +1 -1
  119. package/build/user-event/press/press.d.ts +1 -1
  120. package/build/user-event/press/press.js +2 -3
  121. package/build/user-event/press/press.js.map +1 -1
  122. package/build/user-event/scroll/scroll-to.d.ts +1 -1
  123. package/build/user-event/scroll/scroll-to.js.map +1 -1
  124. package/build/user-event/setup/setup.d.ts +1 -1
  125. package/build/user-event/setup/setup.js.map +1 -1
  126. package/build/user-event/type/type.d.ts +1 -1
  127. package/build/user-event/type/type.js.map +1 -1
  128. package/build/user-event/utils/dispatch-event.d.ts +1 -1
  129. package/build/user-event/utils/dispatch-event.js +2 -5
  130. package/build/user-event/utils/dispatch-event.js.map +1 -1
  131. package/build/user-event/utils/text-range.js +4 -0
  132. package/build/wait-for-element-to-be-removed.d.ts +1 -1
  133. package/build/wait-for-element-to-be-removed.js +3 -4
  134. package/build/wait-for-element-to-be-removed.js.map +1 -1
  135. package/build/wait-for.d.ts +1 -1
  136. package/build/wait-for.js +6 -7
  137. package/build/wait-for.js.map +1 -1
  138. package/build/within.d.ts +1 -1
  139. package/build/within.js.map +1 -1
  140. package/package.json +18 -20
  141. package/build/index.flow.js +0 -378
  142. package/build/render-act.d.ts +0 -3
  143. package/build/render-act.js +0 -29
  144. package/build/render-act.js.map +0 -1
  145. package/build/render-async.d.ts +0 -83
  146. package/build/render-async.js +0 -96
  147. package/build/render-async.js.map +0 -1
  148. package/typings/index.flow.js +0 -378
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/react-native",
3
- "version": "14.0.0-alpha.4",
3
+ "version": "14.0.0-alpha.6",
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",
@@ -26,19 +26,20 @@
26
26
  "clean": "del build",
27
27
  "test": "jest",
28
28
  "test:ci": "jest --maxWorkers=2",
29
- "test:ci:coverage": "jest --maxWorkers=2 --collectCoverage=true --coverage-provider=v8",
29
+ "test:ci:coverage": "jest --maxWorkers=2 --collectCoverage=true",
30
+ "test:codemods": "node scripts/test-codemods.mjs",
30
31
  "typecheck": "tsc",
31
- "copy-flowtypes": "cp typings/index.flow.js build",
32
32
  "lint": "eslint src --cache",
33
- "validate": "yarn prettier && yarn lint && yarn typecheck && yarn test",
33
+ "prettier": "prettier --check .",
34
+ "prettier:fix": "prettier --write .",
35
+ "validate": "yarn typecheck && yarn test && yarn lint && yarn prettier",
36
+ "validate:fix": "yarn prettier:fix && yarn lint --fix && yarn typecheck && yarn test -u",
34
37
  "build:js": "babel src --out-dir build --extensions \".js,.ts,.jsx,.tsx\" --source-maps --ignore \"**/__tests__/**\"",
35
38
  "build:ts": "tsc --build tsconfig.release.json",
36
- "build": "yarn clean && yarn build:js && yarn build:ts && yarn copy-flowtypes",
39
+ "build": "yarn clean && yarn build:js && yarn build:ts",
37
40
  "release": "release-it",
38
41
  "release:rc": "release-it --preRelease=rc",
39
- "release:alpha": "release-it --preRelease=alpha",
40
- "prettier": "prettier --check .",
41
- "prettier:write": "prettier --write ."
42
+ "release:alpha": "release-it --preRelease=alpha"
42
43
  },
43
44
  "files": [
44
45
  "build/",
@@ -46,8 +47,7 @@
46
47
  "matchers.d.ts",
47
48
  "pure.js",
48
49
  "pure.d.ts",
49
- "dont-cleanup-after-each.js",
50
- "typings/index.flow.js"
50
+ "dont-cleanup-after-each.js"
51
51
  ],
52
52
  "dependencies": {
53
53
  "jest-matcher-utils": "^30.2.0",
@@ -58,8 +58,8 @@
58
58
  "peerDependencies": {
59
59
  "jest": ">=29.0.0",
60
60
  "react": ">=19.0.0",
61
- "react-native": ">=0.71",
62
- "universal-test-renderer": "~0.10.1"
61
+ "react-native": ">=0.78",
62
+ "test-renderer": "~0.10.1"
63
63
  },
64
64
  "peerDependenciesMeta": {
65
65
  "jest": {
@@ -71,11 +71,10 @@
71
71
  "@babel/core": "^7.28.5",
72
72
  "@babel/plugin-transform-strict-mode": "^7.27.1",
73
73
  "@babel/preset-env": "^7.28.5",
74
- "@babel/preset-flow": "^7.27.1",
75
74
  "@babel/preset-react": "^7.28.5",
76
75
  "@babel/preset-typescript": "^7.28.5",
77
76
  "@callstack/eslint-config": "^15.0.0",
78
- "@react-native/babel-preset": "0.82.1",
77
+ "@react-native/babel-preset": "0.83.1",
79
78
  "@release-it/conventional-changelog": "^10.0.2",
80
79
  "@relmify/jest-serializer-strip-ansi": "^1.0.2",
81
80
  "@types/jest": "^30.0.0",
@@ -86,22 +85,21 @@
86
85
  "del-cli": "^7.0.0",
87
86
  "eslint": "^9.39.1",
88
87
  "eslint-plugin-simple-import-sort": "^12.1.1",
89
- "flow-bin": "~0.170.0",
90
88
  "jest": "^30.2.0",
91
89
  "prettier": "^3.6.2",
92
- "react": "19.1.1",
93
- "react-native": "0.82.1",
90
+ "react": "19.2.0",
91
+ "react-native": "0.83.1",
94
92
  "react-native-gesture-handler": "^2.29.1",
95
93
  "release-it": "^19.0.6",
94
+ "test-renderer": "0.13.0",
96
95
  "typescript": "^5.9.3",
97
- "typescript-eslint": "^8.47.0",
98
- "universal-test-renderer": "0.10.1"
96
+ "typescript-eslint": "^8.47.0"
99
97
  },
100
98
  "publishConfig": {
101
99
  "registry": "https://registry.npmjs.org"
102
100
  },
103
101
  "packageManager": "yarn@4.11.0",
104
102
  "engines": {
105
- "node": ">=18"
103
+ "node": ">=20"
106
104
  }
107
105
  }
@@ -1,378 +0,0 @@
1
- // @flow
2
- import * as React from 'react';
3
-
4
- type GetReturn = ReactTestInstance;
5
- type GetAllReturn = Array<ReactTestInstance>;
6
- type QueryReturn = ReactTestInstance | null;
7
- type QueryAllReturn = Array<ReactTestInstance> | [];
8
- type FindReturn = Promise<ReactTestInstance>;
9
- type FindAllReturn = Promise<ReactTestInstance[]>;
10
-
11
- type CommonQueryOptions = {
12
- includeHiddenElements?: boolean,
13
- hidden?: boolean,
14
- };
15
-
16
- type TextMatch = string | RegExp;
17
-
18
- declare type NormalizerFn = (textToNormalize: string) => string;
19
- declare type NormalizerConfig = {
20
- trim?: boolean,
21
- collapseWhitespace?: boolean,
22
- };
23
- declare type TextMatchOptions = {
24
- exact?: boolean,
25
- normalizer?: NormalizerFn,
26
- };
27
- declare type A11yRole =
28
- | 'none'
29
- | 'button'
30
- | 'link'
31
- | 'search'
32
- | 'image'
33
- | 'keyboardkey'
34
- | 'text'
35
- | 'adjustable'
36
- | 'imagebutton'
37
- | 'header'
38
- | 'summary'
39
- | 'alert'
40
- | 'checkbox'
41
- | 'combobox'
42
- | 'menu'
43
- | 'menubar'
44
- | 'menuitem'
45
- | 'progressbar'
46
- | 'radio'
47
- | 'radiogroup'
48
- | 'scrollbar'
49
- | 'spinbutton'
50
- | 'switch'
51
- | 'tab'
52
- | 'tablist'
53
- | 'timer'
54
- | 'toolbar';
55
-
56
- declare type A11yState = {|
57
- disabled?: boolean,
58
- selected?: boolean,
59
- checked?: boolean | 'mixed',
60
- busy?: boolean,
61
- expanded?: boolean,
62
- |};
63
-
64
- declare type A11yValue = {
65
- min?: number,
66
- max?: number,
67
- now?: number,
68
- text?: TextMatch,
69
- };
70
-
71
- type WaitForOptions = {
72
- timeout?: number,
73
- interval?: number,
74
- onTimeout?: (error: Error) => Error,
75
- };
76
-
77
- type WaitForFunction = <T = any>(expectation: () => T, options?: WaitForOptions) => Promise<T>;
78
-
79
- type ByTextOptions = CommonQueryOptions & TextMatchOptions;
80
-
81
- interface ByTextQueries {
82
- getByText: (text: TextMatch, options?: ByTextOptions) => ReactTestInstance;
83
- getAllByText: (text: TextMatch, options?: ByTextOptions) => Array<ReactTestInstance>;
84
- queryByText: (name: TextMatch, options?: ByTextOptions) => ReactTestInstance | null;
85
- queryAllByText: (text: TextMatch, options?: ByTextOptions) => Array<ReactTestInstance> | [];
86
- findByText: (
87
- text: TextMatch,
88
- queryOptions?: ByTextOptions,
89
- waitForOptions?: WaitForOptions,
90
- ) => FindReturn;
91
- findAllByText: (
92
- text: TextMatch,
93
- queryOptions?: ByTextOptions,
94
- waitForOptions?: WaitForOptions,
95
- ) => FindAllReturn;
96
- }
97
-
98
- type ByTestIdOptions = CommonQueryOptions & TextMatchOptions;
99
-
100
- interface ByTestIdQueries {
101
- getByTestId: (testID: TextMatch, options?: ByTestIdOptions) => ReactTestInstance;
102
- getAllByTestId: (testID: TextMatch, options?: ByTestIdOptions) => Array<ReactTestInstance>;
103
- queryByTestId: (testID: TextMatch, options?: ByTestIdOptions) => ReactTestInstance | null;
104
- queryAllByTestId: (testID: TextMatch, options?: ByTestIdOptions) => Array<ReactTestInstance> | [];
105
- findByTestId: (
106
- testID: TextMatch,
107
- queryOptions?: ByTestIdOptions,
108
- waitForOptions?: WaitForOptions,
109
- ) => FindReturn;
110
- findAllByTestId: (
111
- testID: TextMatch,
112
- queryOptions?: ByTestIdOptions,
113
- waitForOptions?: WaitForOptions,
114
- ) => FindAllReturn;
115
- }
116
-
117
- type ByDisplayValueOptions = CommonQueryOptions & TextMatchOptions;
118
-
119
- interface ByDisplayValueQueries {
120
- getByDisplayValue: (value: TextMatch, options?: ByDisplayValueOptions) => ReactTestInstance;
121
- getAllByDisplayValue: (
122
- value: TextMatch,
123
- options?: ByDisplayValueOptions,
124
- ) => Array<ReactTestInstance>;
125
- queryByDisplayValue: (
126
- value: TextMatch,
127
- options?: ByDisplayValueOptions,
128
- ) => ReactTestInstance | null;
129
- queryAllByDisplayValue: (
130
- value: TextMatch,
131
- options?: ByDisplayValueOptions,
132
- ) => Array<ReactTestInstance> | [];
133
- findByDisplayValue: (
134
- value: TextMatch,
135
- queryOptions?: ByDisplayValueOptions,
136
- waitForOptions?: WaitForOptions,
137
- ) => FindReturn;
138
- findAllByDisplayValue: (
139
- value: TextMatch,
140
- queryOptions?: ByDisplayValueOptions,
141
- waitForOptions?: WaitForOptions,
142
- ) => FindAllReturn;
143
- }
144
-
145
- type ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;
146
-
147
- interface ByPlaceholderTextQueries {
148
- getByPlaceholderText: (
149
- placeholder: TextMatch,
150
- options?: ByPlaceholderTextOptions,
151
- ) => ReactTestInstance;
152
- getAllByPlaceholderText: (
153
- placeholder: TextMatch,
154
- options?: ByPlaceholderTextOptions,
155
- ) => Array<ReactTestInstance>;
156
- queryByPlaceholderText: (
157
- placeholder: TextMatch,
158
- options?: ByPlaceholderTextOptions,
159
- ) => ReactTestInstance | null;
160
- queryAllByPlaceholderText: (
161
- placeholder: TextMatch,
162
- options?: ByPlaceholderTextOptions,
163
- ) => Array<ReactTestInstance> | [];
164
- findByPlaceholderText: (
165
- placeholder: TextMatch,
166
- queryOptions?: ByPlaceholderTextOptions,
167
- waitForOptions?: WaitForOptions,
168
- ) => FindReturn;
169
- findAllByPlaceholderText: (
170
- placeholder: TextMatch,
171
- queryOptions?: ByPlaceholderTextOptions,
172
- waitForOptions?: WaitForOptions,
173
- ) => FindAllReturn;
174
- }
175
-
176
- interface UnsafeByTypeQueries {
177
- UNSAFE_getByType: <P>(type: React.ComponentType<P>) => ReactTestInstance;
178
- UNSAFE_getAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance>;
179
- UNSAFE_queryByType: <P>(type: React.ComponentType<P>) => ReactTestInstance | null;
180
- UNSAFE_queryAllByType: <P>(type: React.ComponentType<P>) => Array<ReactTestInstance> | [];
181
- }
182
-
183
- interface UnsafeByPropsQueries {
184
- UNSAFE_getByProps: (props: { [string]: any }) => ReactTestInstance;
185
- UNSAFE_getAllByProps: (props: { [string]: any }) => Array<ReactTestInstance>;
186
- UNSAFE_queryByProps: (props: { [string]: any }) => ReactTestInstance | null;
187
- UNSAFE_queryAllByProps: (props: { [string]: any }) => Array<ReactTestInstance> | [];
188
- }
189
-
190
- type ByRoleOptions = CommonQueryOptions & {
191
- ...A11yState,
192
- name?: string,
193
- value?: A11yValue,
194
- };
195
-
196
- type ByLabelTextOptions = CommonQueryOptions & TextMatchOptions;
197
- type ByHintTextOptions = CommonQueryOptions & TextMatchOptions;
198
-
199
- interface A11yAPI {
200
- // Label
201
- getByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => GetReturn;
202
- getAllByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => GetAllReturn;
203
- queryByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => QueryReturn;
204
- queryAllByLabelText: (matcher: TextMatch, options?: ByLabelTextOptions) => QueryAllReturn;
205
- findByLabelText: (
206
- matcher: TextMatch,
207
- queryOptions?: ByLabelTextOptions,
208
- waitForOptions?: WaitForOptions,
209
- ) => FindReturn;
210
- findAllByLabelText: (
211
- matcher: TextMatch,
212
- queryOptions?: ByLabelTextOptions,
213
- waitForOptions?: WaitForOptions,
214
- ) => FindAllReturn;
215
-
216
- // Hint
217
- getByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => GetReturn;
218
- getByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => GetReturn;
219
- getAllByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => GetAllReturn;
220
- getAllByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => GetAllReturn;
221
- queryByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => QueryReturn;
222
- queryByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => QueryReturn;
223
- queryAllByA11yHint: (matcher: TextMatch, options?: ByHintTextOptions) => QueryAllReturn;
224
- queryAllByHintText: (matcher: TextMatch, options?: ByHintTextOptions) => QueryAllReturn;
225
- findByA11yHint: (
226
- matcher: TextMatch,
227
- queryOptions?: ByHintTextOptions,
228
- waitForOptions?: WaitForOptions,
229
- ) => FindReturn;
230
- findByHintText: (
231
- matcher: TextMatch,
232
- queryOptions?: ByHintTextOptions,
233
- waitForOptions?: WaitForOptions,
234
- ) => FindReturn;
235
- findAllByA11yHint: (
236
- matcher: TextMatch,
237
- queryOptions?: ByHintTextOptions,
238
- waitForOptions?: WaitForOptions,
239
- ) => FindAllReturn;
240
- findAllByHintText: (
241
- matcher: TextMatch,
242
- queryOptions?: ByHintTextOptions,
243
- waitForOptions?: WaitForOptions,
244
- ) => FindAllReturn;
245
-
246
- // Role
247
- getByRole: (matcher: A11yRole | RegExp, role?: ByRoleOptions) => GetReturn;
248
- getAllByRole: (matcher: A11yRole | RegExp, options?: ByRoleOptions) => GetAllReturn;
249
- queryByRole: (matcher: A11yRole | RegExp, options?: ByRoleOptions) => QueryReturn;
250
- queryAllByRole: (matcher: A11yRole | RegExp, options?: ByRoleOptions) => QueryAllReturn;
251
- findByRole: (
252
- matcher: A11yRole | RegExp,
253
- queryOptions?: ByRoleOptions,
254
- waitForOptions?: WaitForOptions,
255
- ) => FindReturn;
256
- findAllByRole: (
257
- matcher: A11yRole | RegExp,
258
- queryOptions?: ByRoleOptions,
259
- waitForOptions?: WaitForOptions,
260
- ) => FindAllReturn;
261
- }
262
-
263
- interface Thenable {
264
- then: (resolve: () => any, reject?: () => any) => any;
265
- }
266
-
267
- type MapPropsFunction = (
268
- props: { [string]: mixed },
269
- node: ReactTestRendererJSON,
270
- ) => { [string]: mixed };
271
-
272
- type DebugOptions = {
273
- message?: string,
274
- mapProps?: MapPropsFunction,
275
- };
276
-
277
- type Queries = ByTextQueries &
278
- ByTestIdQueries &
279
- ByDisplayValueQueries &
280
- ByPlaceholderTextQueries &
281
- UnsafeByTypeQueries &
282
- UnsafeByPropsQueries &
283
- A11yAPI;
284
-
285
- type FireEventFunction = (
286
- element: ReactTestInstance,
287
- eventName: string,
288
- ...data: Array<any>
289
- ) => any;
290
-
291
- type FireEventAPI = FireEventFunction & {
292
- press: (element: ReactTestInstance, ...data: Array<any>) => any,
293
- changeText: (element: ReactTestInstance, ...data: Array<any>) => any,
294
- scroll: (element: ReactTestInstance, ...data: Array<any>) => any,
295
- };
296
-
297
- declare module '@testing-library/react-native' {
298
- declare interface RenderResult extends Queries {
299
- update(nextElement: React.Element<any>): void;
300
- rerender(nextElement: React.Element<any>): void;
301
- unmount(nextElement?: React.Element<any>): void;
302
- toJSON(): ReactTestRendererJSON[] | ReactTestRendererJSON | null;
303
- debug(options?: DebugOptions): void;
304
- root: ReactTestInstance;
305
- UNSAFE_root: ReactTestInstance;
306
- }
307
-
308
- declare type RenderAPI = RenderResult;
309
-
310
- declare interface RenderOptions {
311
- wrapper?: React.ComponentType<any>;
312
- createNodeMock?: (element: React.Element<any>) => any;
313
- unstable_validateStringsRenderedWithinText?: boolean;
314
- unstable_isConcurrent?: boolean;
315
- unstable_strictMode?: boolean;
316
- unstable_concurrentUpdatesByDefault?: boolean;
317
- }
318
-
319
- declare export var render: (
320
- component: React.Element<any>,
321
- options?: RenderOptions,
322
- ) => RenderResult;
323
-
324
- declare export var screen: RenderResult;
325
-
326
- declare export var cleanup: () => void;
327
- declare export var fireEvent: FireEventAPI;
328
-
329
- declare export var waitFor: WaitForFunction;
330
-
331
- declare type WaitForElementToBeRemovedFunction = <T = any>(
332
- expectation: () => T,
333
- options?: WaitForOptions,
334
- ) => Promise<T>;
335
-
336
- declare export var waitForElementToBeRemoved: WaitForElementToBeRemovedFunction;
337
-
338
- declare interface Config {
339
- asyncUtilTimeout: number;
340
- defaultIncludeHiddenElements: boolean;
341
- defaultDebugOptions?: $Shape<DebugOptions>;
342
- }
343
-
344
- declare interface ConfigAliasOptions {
345
- /** Alias to `defaultIncludeHiddenElements` for RTL compatibility */
346
- defaultHidden: boolean;
347
- }
348
-
349
- declare export var configure: (options: $Shape<Config & ConfigAliasOptions>) => void;
350
- declare export var resetToDefaults: () => void;
351
-
352
- declare export var act: (callback: () => void) => Thenable;
353
- declare export var within: (instance: ReactTestInstance) => Queries;
354
- declare export var getQueriesForElement: (element: ReactTestInstance) => Queries;
355
-
356
- declare export var getDefaultNormalizer: (normalizerConfig?: NormalizerConfig) => NormalizerFn;
357
-
358
- declare export var isHiddenFromAccessibility: (element: ReactTestInstance | null) => boolean;
359
- declare export var isInaccessible: (element: ReactTestInstance | null) => boolean;
360
-
361
- declare type RenderHookResult<Result, Props> = {
362
- rerender: (props: Props) => void,
363
- result: { current: Result },
364
- unmount: () => void,
365
- };
366
-
367
- declare type RenderHookOptions<Props> = {
368
- initialProps?: Props,
369
- wrapper?: React.ComponentType<any>,
370
- };
371
-
372
- declare type RenderHookFunction = <Result, Props>(
373
- renderCallback: (props: Props) => Result,
374
- options?: RenderHookOptions<Props>,
375
- ) => RenderHookResult<Result, Props>;
376
-
377
- declare export var renderHook: RenderHookFunction;
378
- }
@@ -1,3 +0,0 @@
1
- import type { Root, RootOptions } from 'universal-test-renderer';
2
- export declare function renderWithAct(element: React.ReactElement, options?: RootOptions): Root;
3
- export declare function renderWithAsyncAct(element: React.ReactElement, options?: RootOptions): Promise<Root>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.renderWithAct = renderWithAct;
7
- exports.renderWithAsyncAct = renderWithAsyncAct;
8
- var _universalTestRenderer = require("universal-test-renderer");
9
- var _act = _interopRequireDefault(require("./act"));
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- function renderWithAct(element, options) {
12
- const root = (0, _universalTestRenderer.createRoot)(options);
13
-
14
- // This will be called synchronously.
15
- void (0, _act.default)(() => {
16
- root.render(element);
17
- });
18
- return root;
19
- }
20
- async function renderWithAsyncAct(element, options) {
21
- const root = (0, _universalTestRenderer.createRoot)(options);
22
-
23
- // eslint-disable-next-line require-await
24
- await (0, _act.default)(async () => {
25
- root.render(element);
26
- });
27
- return root;
28
- }
29
- //# sourceMappingURL=render-act.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"render-act.js","names":["_universalTestRenderer","require","_act","_interopRequireDefault","e","__esModule","default","renderWithAct","element","options","root","createRoot","act","render","renderWithAsyncAct"],"sources":["../src/render-act.ts"],"sourcesContent":["import type { Root, RootOptions } from 'universal-test-renderer';\nimport { createRoot } from 'universal-test-renderer';\n\nimport act from './act';\n\nexport function renderWithAct(element: React.ReactElement, options?: RootOptions): Root {\n const root = createRoot(options);\n\n // This will be called synchronously.\n void act(() => {\n root.render(element);\n });\n\n return root;\n}\n\nexport async function renderWithAsyncAct(\n element: React.ReactElement,\n options?: RootOptions,\n): Promise<Root> {\n const root = createRoot(options);\n\n // eslint-disable-next-line require-await\n await act(async () => {\n root.render(element);\n });\n\n return root;\n}\n"],"mappings":";;;;;;;AACA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,IAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAwB,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEjB,SAASG,aAAaA,CAACC,OAA2B,EAAEC,OAAqB,EAAQ;EACtF,MAAMC,IAAI,GAAG,IAAAC,iCAAU,EAACF,OAAO,CAAC;;EAEhC;EACA,KAAK,IAAAG,YAAG,EAAC,MAAM;IACbF,IAAI,CAACG,MAAM,CAACL,OAAO,CAAC;EACtB,CAAC,CAAC;EAEF,OAAOE,IAAI;AACb;AAEO,eAAeI,kBAAkBA,CACtCN,OAA2B,EAC3BC,OAAqB,EACN;EACf,MAAMC,IAAI,GAAG,IAAAC,iCAAU,EAACF,OAAO,CAAC;;EAEhC;EACA,MAAM,IAAAG,YAAG,EAAC,YAAY;IACpBF,IAAI,CAACG,MAAM,CAACL,OAAO,CAAC;EACtB,CAAC,CAAC;EAEF,OAAOE,IAAI;AACb","ignoreList":[]}
@@ -1,83 +0,0 @@
1
- import * as React from 'react';
2
- import type { HostElement } from 'universal-test-renderer';
3
- import type { DebugOptions } from './helpers/debug';
4
- export interface RenderAsyncOptions {
5
- /**
6
- * Pass a React Component as the wrapper option to have it rendered around the inner element. This is most useful for creating
7
- * reusable custom render functions for common data providers.
8
- */
9
- wrapper?: React.ComponentType<any>;
10
- createNodeMock?: (element: React.ReactElement) => unknown;
11
- }
12
- export type RenderAsyncResult = ReturnType<typeof renderAsync>;
13
- /**
14
- * Renders test component deeply using React Test Renderer and exposes helpers
15
- * to assert on the output.
16
- */
17
- export default function renderAsync<T>(component: React.ReactElement<T>, options?: RenderAsyncOptions): Promise<{
18
- rerender: (_component: React.ReactElement) => never;
19
- rerenderAsync: (component: React.ReactElement) => Promise<void>;
20
- update: (_component: React.ReactElement) => never;
21
- updateAsync: (component: React.ReactElement) => Promise<void>;
22
- unmount: () => never;
23
- unmountAsync: () => Promise<void>;
24
- toJSON: () => import("universal-test-renderer").JsonElement | null;
25
- debug: DebugFunction;
26
- container: HostElement;
27
- root: HostElement | null;
28
- getByRole: import("./queries/make-queries").GetByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
29
- getAllByRole: import("./queries/make-queries").GetAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
30
- queryByRole: import("./queries/make-queries").QueryByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
31
- queryAllByRole: import("./queries/make-queries").QueryAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
32
- findByRole: import("./queries/make-queries").FindByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
33
- findAllByRole: import("./queries/make-queries").FindAllByQuery<import("./queries/role").ByRoleMatcher, import("./queries/role").ByRoleOptions>;
34
- getByHintText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
35
- getAllByHintText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
36
- queryByHintText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
37
- queryAllByHintText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
38
- findByHintText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
39
- findAllByHintText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
40
- getByA11yHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
41
- getAllByA11yHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
42
- queryByA11yHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
43
- queryAllByA11yHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
44
- findByA11yHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
45
- findAllByA11yHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
46
- getByAccessibilityHint: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
47
- getAllByAccessibilityHint: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
48
- queryByAccessibilityHint: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
49
- queryAllByAccessibilityHint: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
50
- findByAccessibilityHint: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
51
- findAllByAccessibilityHint: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
52
- getByLabelText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
53
- getAllByLabelText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
54
- queryByLabelText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
55
- queryAllByLabelText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
56
- findByLabelText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
57
- findAllByLabelText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
58
- getByPlaceholderText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
59
- getAllByPlaceholderText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
60
- queryByPlaceholderText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
61
- queryAllByPlaceholderText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
62
- findByPlaceholderText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
63
- findAllByPlaceholderText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
64
- getByDisplayValue: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
65
- getAllByDisplayValue: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
66
- queryByDisplayValue: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
67
- queryAllByDisplayValue: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
68
- findByDisplayValue: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
69
- findAllByDisplayValue: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
70
- getByTestId: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
71
- getAllByTestId: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
72
- queryByTestId: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
73
- queryAllByTestId: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
74
- findByTestId: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
75
- findAllByTestId: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
76
- getByText: import("./queries/make-queries").GetByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
77
- getAllByText: import("./queries/make-queries").GetAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
78
- queryByText: import("./queries/make-queries").QueryByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
79
- queryAllByText: import("./queries/make-queries").QueryAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
80
- findByText: import("./queries/make-queries").FindByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
81
- findAllByText: import("./queries/make-queries").FindAllByQuery<import("./matches").TextMatch, import("./queries/options").CommonQueryOptions & import("./matches").TextMatchOptions>;
82
- }>;
83
- export type DebugFunction = (options?: DebugOptions) => void;