@testing-library/react-native 13.0.0 → 13.1.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 (192) hide show
  1. package/README.md +1 -2
  2. package/build/act.d.ts +1 -1
  3. package/build/act.js +1 -3
  4. package/build/act.js.map +1 -1
  5. package/build/config.d.ts +1 -1
  6. package/build/config.js.map +1 -1
  7. package/build/event-handler.d.ts +7 -0
  8. package/build/event-handler.js +30 -0
  9. package/build/event-handler.js.map +1 -0
  10. package/build/fire-event.d.ts +3 -3
  11. package/build/fire-event.js +4 -14
  12. package/build/fire-event.js.map +1 -1
  13. package/build/helpers/accessibility.d.ts +1 -1
  14. package/build/helpers/accessibility.js.map +1 -1
  15. package/build/helpers/component-tree.d.ts +1 -1
  16. package/build/helpers/component-tree.js.map +1 -1
  17. package/build/helpers/debug.d.ts +3 -3
  18. package/build/helpers/debug.js +8 -11
  19. package/build/helpers/debug.js.map +1 -1
  20. package/build/helpers/errors.js +4 -4
  21. package/build/helpers/errors.js.map +1 -1
  22. package/build/helpers/find-all.d.ts +2 -2
  23. package/build/helpers/find-all.js.map +1 -1
  24. package/build/helpers/format-element.d.ts +18 -0
  25. package/build/helpers/format-element.js +81 -0
  26. package/build/helpers/format-element.js.map +1 -0
  27. package/build/helpers/host-component-names.d.ts +2 -2
  28. package/build/helpers/host-component-names.js.map +1 -1
  29. package/build/helpers/logger.d.ts +6 -0
  30. package/build/helpers/logger.js +37 -0
  31. package/build/helpers/logger.js.map +1 -0
  32. package/build/helpers/{format-default.d.ts → map-props.d.ts} +1 -0
  33. package/build/helpers/{format-default.js → map-props.js} +2 -2
  34. package/build/helpers/map-props.js.map +1 -0
  35. package/build/helpers/matchers/match-accessibility-state.d.ts +1 -1
  36. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  37. package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
  38. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  39. package/build/helpers/matchers/match-label-text.d.ts +2 -2
  40. package/build/helpers/matchers/match-label-text.js.map +1 -1
  41. package/build/helpers/matchers/match-string-prop.d.ts +1 -1
  42. package/build/helpers/matchers/match-string-prop.js.map +1 -1
  43. package/build/helpers/matchers/match-text-content.d.ts +1 -1
  44. package/build/helpers/matchers/match-text-content.js.map +1 -1
  45. package/build/helpers/object.d.ts +1 -1
  46. package/build/helpers/object.js.map +1 -1
  47. package/build/helpers/pointer-events.d.ts +1 -1
  48. package/build/helpers/pointer-events.js.map +1 -1
  49. package/build/helpers/string-validation.d.ts +1 -1
  50. package/build/helpers/string-validation.js.map +1 -1
  51. package/build/helpers/text-input.d.ts +1 -1
  52. package/build/helpers/text-input.js.map +1 -1
  53. package/build/helpers/timers.d.ts +1 -1
  54. package/build/helpers/timers.js.map +1 -1
  55. package/build/index.flow.js +28 -32
  56. package/build/index.js +3 -4
  57. package/build/index.js.map +1 -1
  58. package/build/matchers/extend-expect.js +2 -2
  59. package/build/matchers/extend-expect.js.map +1 -1
  60. package/build/matchers/index.d.ts +1 -1
  61. package/build/matchers/index.js.map +1 -1
  62. package/build/matchers/to-be-busy.d.ts +1 -1
  63. package/build/matchers/to-be-busy.js +4 -1
  64. package/build/matchers/to-be-busy.js.map +1 -1
  65. package/build/matchers/to-be-checked.js +4 -1
  66. package/build/matchers/to-be-checked.js.map +1 -1
  67. package/build/matchers/to-be-disabled.js +5 -2
  68. package/build/matchers/to-be-disabled.js.map +1 -1
  69. package/build/matchers/to-be-empty-element.d.ts +1 -1
  70. package/build/matchers/to-be-empty-element.js +4 -1
  71. package/build/matchers/to-be-empty-element.js.map +1 -1
  72. package/build/matchers/to-be-expanded.d.ts +1 -1
  73. package/build/matchers/to-be-expanded.js +5 -2
  74. package/build/matchers/to-be-expanded.js.map +1 -1
  75. package/build/matchers/to-be-on-the-screen.js +4 -1
  76. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  77. package/build/matchers/to-be-partially-checked.js +4 -1
  78. package/build/matchers/to-be-partially-checked.js.map +1 -1
  79. package/build/matchers/to-be-selected.d.ts +1 -1
  80. package/build/matchers/to-be-selected.js +4 -1
  81. package/build/matchers/to-be-selected.js.map +1 -1
  82. package/build/matchers/to-be-visible.js +5 -2
  83. package/build/matchers/to-be-visible.js.map +1 -1
  84. package/build/matchers/to-contain-element.d.ts +1 -1
  85. package/build/matchers/to-contain-element.js +4 -1
  86. package/build/matchers/to-contain-element.js.map +1 -1
  87. package/build/matchers/to-have-accessibility-value.d.ts +1 -1
  88. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  89. package/build/matchers/to-have-accessible-name.d.ts +1 -1
  90. package/build/matchers/to-have-accessible-name.js.map +1 -1
  91. package/build/matchers/to-have-display-value.d.ts +1 -1
  92. package/build/matchers/to-have-display-value.js +1 -1
  93. package/build/matchers/to-have-display-value.js.map +1 -1
  94. package/build/matchers/to-have-prop.js.map +1 -1
  95. package/build/matchers/to-have-style.d.ts +1 -1
  96. package/build/matchers/to-have-style.js.map +1 -1
  97. package/build/matchers/to-have-text-content.d.ts +1 -1
  98. package/build/matchers/to-have-text-content.js.map +1 -1
  99. package/build/matchers/types.d.ts +3 -3
  100. package/build/matchers/types.js.map +1 -1
  101. package/build/matchers/utils.d.ts +1 -8
  102. package/build/matchers/utils.js +0 -41
  103. package/build/matchers/utils.js.map +1 -1
  104. package/build/native-state.d.ts +3 -3
  105. package/build/native-state.js +1 -1
  106. package/build/native-state.js.map +1 -1
  107. package/build/queries/display-value.d.ts +1 -1
  108. package/build/queries/display-value.js.map +1 -1
  109. package/build/queries/hint-text.d.ts +2 -2
  110. package/build/queries/hint-text.js.map +1 -1
  111. package/build/queries/label-text.d.ts +2 -2
  112. package/build/queries/label-text.js.map +1 -1
  113. package/build/queries/make-queries.js +5 -8
  114. package/build/queries/make-queries.js.map +1 -1
  115. package/build/queries/options.d.ts +1 -1
  116. package/build/queries/options.js.map +1 -1
  117. package/build/queries/placeholder-text.d.ts +1 -1
  118. package/build/queries/placeholder-text.js +1 -1
  119. package/build/queries/placeholder-text.js.map +1 -1
  120. package/build/queries/role.d.ts +5 -5
  121. package/build/queries/role.js.map +1 -1
  122. package/build/queries/test-id.d.ts +1 -1
  123. package/build/queries/test-id.js.map +1 -1
  124. package/build/queries/text.d.ts +1 -1
  125. package/build/queries/text.js.map +1 -1
  126. package/build/queries/unsafe-props.d.ts +6 -12
  127. package/build/queries/unsafe-props.js.map +1 -1
  128. package/build/queries/unsafe-type.d.ts +2 -1
  129. package/build/queries/unsafe-type.js +2 -0
  130. package/build/queries/unsafe-type.js.map +1 -1
  131. package/build/render-act.js +2 -2
  132. package/build/render-act.js.map +1 -1
  133. package/build/render-hook.d.ts +16 -6
  134. package/build/render-hook.js +21 -21
  135. package/build/render-hook.js.map +1 -1
  136. package/build/render.d.ts +12 -12
  137. package/build/render.js +9 -18
  138. package/build/render.js.map +1 -1
  139. package/build/screen.d.ts +1 -1
  140. package/build/screen.js.map +1 -1
  141. package/build/tsconfig.release.tsbuildinfo +1 -1
  142. package/build/user-event/clear.d.ts +2 -2
  143. package/build/user-event/clear.js +2 -2
  144. package/build/user-event/clear.js.map +1 -1
  145. package/build/user-event/event-builder/base.d.ts +2 -2
  146. package/build/user-event/event-builder/base.js.map +1 -1
  147. package/build/user-event/event-builder/scroll-view.d.ts +1 -1
  148. package/build/user-event/event-builder/scroll-view.js.map +1 -1
  149. package/build/user-event/event-builder/text-input.d.ts +2 -2
  150. package/build/user-event/event-builder/text-input.js.map +1 -1
  151. package/build/user-event/index.d.ts +4 -4
  152. package/build/user-event/index.js.map +1 -1
  153. package/build/user-event/paste.d.ts +2 -2
  154. package/build/user-event/paste.js.map +1 -1
  155. package/build/user-event/press/index.d.ts +1 -1
  156. package/build/user-event/press/index.js.map +1 -1
  157. package/build/user-event/press/press.d.ts +2 -2
  158. package/build/user-event/press/press.js +42 -42
  159. package/build/user-event/press/press.js.map +1 -1
  160. package/build/user-event/scroll/index.d.ts +1 -1
  161. package/build/user-event/scroll/index.js.map +1 -1
  162. package/build/user-event/scroll/scroll-to.d.ts +3 -3
  163. package/build/user-event/scroll/scroll-to.js +1 -1
  164. package/build/user-event/scroll/scroll-to.js.map +1 -1
  165. package/build/user-event/scroll/utils.d.ts +1 -1
  166. package/build/user-event/scroll/utils.js.map +1 -1
  167. package/build/user-event/setup/setup.d.ts +4 -4
  168. package/build/user-event/setup/setup.js.map +1 -1
  169. package/build/user-event/type/type.d.ts +2 -2
  170. package/build/user-event/type/type.js +3 -3
  171. package/build/user-event/type/type.js.map +1 -1
  172. package/build/user-event/utils/content-size.d.ts +1 -1
  173. package/build/user-event/utils/content-size.js.map +1 -1
  174. package/build/user-event/utils/dispatch-event.d.ts +1 -1
  175. package/build/user-event/utils/dispatch-event.js +2 -12
  176. package/build/user-event/utils/dispatch-event.js.map +1 -1
  177. package/build/user-event/utils/wait.d.ts +6 -2
  178. package/build/user-event/utils/wait.js +1 -1
  179. package/build/user-event/utils/wait.js.map +1 -1
  180. package/build/wait-for-element-to-be-removed.js +1 -1
  181. package/build/wait-for-element-to-be-removed.js.map +1 -1
  182. package/build/wait-for.js +1 -4
  183. package/build/wait-for.js.map +1 -1
  184. package/build/within.d.ts +4 -4
  185. package/build/within.js +5 -5
  186. package/build/within.js.map +1 -1
  187. package/package.json +15 -13
  188. package/typings/index.flow.js +28 -32
  189. package/build/helpers/format-default.js.map +0 -1
  190. package/build/helpers/format.d.ts +0 -7
  191. package/build/helpers/format.js +0 -31
  192. package/build/helpers/format.js.map +0 -1
@@ -86,12 +86,12 @@ interface ByTextQueries {
86
86
  findByText: (
87
87
  text: TextMatch,
88
88
  queryOptions?: ByTextOptions,
89
- waitForOptions?: WaitForOptions
89
+ waitForOptions?: WaitForOptions,
90
90
  ) => FindReturn;
91
91
  findAllByText: (
92
92
  text: TextMatch,
93
93
  queryOptions?: ByTextOptions,
94
- waitForOptions?: WaitForOptions
94
+ waitForOptions?: WaitForOptions,
95
95
  ) => FindAllReturn;
96
96
  }
97
97
 
@@ -105,12 +105,12 @@ interface ByTestIdQueries {
105
105
  findByTestId: (
106
106
  testID: TextMatch,
107
107
  queryOptions?: ByTestIdOptions,
108
- waitForOptions?: WaitForOptions
108
+ waitForOptions?: WaitForOptions,
109
109
  ) => FindReturn;
110
110
  findAllByTestId: (
111
111
  testID: TextMatch,
112
112
  queryOptions?: ByTestIdOptions,
113
- waitForOptions?: WaitForOptions
113
+ waitForOptions?: WaitForOptions,
114
114
  ) => FindAllReturn;
115
115
  }
116
116
 
@@ -120,25 +120,25 @@ interface ByDisplayValueQueries {
120
120
  getByDisplayValue: (value: TextMatch, options?: ByDisplayValueOptions) => ReactTestInstance;
121
121
  getAllByDisplayValue: (
122
122
  value: TextMatch,
123
- options?: ByDisplayValueOptions
123
+ options?: ByDisplayValueOptions,
124
124
  ) => Array<ReactTestInstance>;
125
125
  queryByDisplayValue: (
126
126
  value: TextMatch,
127
- options?: ByDisplayValueOptions
127
+ options?: ByDisplayValueOptions,
128
128
  ) => ReactTestInstance | null;
129
129
  queryAllByDisplayValue: (
130
130
  value: TextMatch,
131
- options?: ByDisplayValueOptions
131
+ options?: ByDisplayValueOptions,
132
132
  ) => Array<ReactTestInstance> | [];
133
133
  findByDisplayValue: (
134
134
  value: TextMatch,
135
135
  queryOptions?: ByDisplayValueOptions,
136
- waitForOptions?: WaitForOptions
136
+ waitForOptions?: WaitForOptions,
137
137
  ) => FindReturn;
138
138
  findAllByDisplayValue: (
139
139
  value: TextMatch,
140
140
  queryOptions?: ByDisplayValueOptions,
141
- waitForOptions?: WaitForOptions
141
+ waitForOptions?: WaitForOptions,
142
142
  ) => FindAllReturn;
143
143
  }
144
144
 
@@ -147,29 +147,29 @@ type ByPlaceholderTextOptions = CommonQueryOptions & TextMatchOptions;
147
147
  interface ByPlaceholderTextQueries {
148
148
  getByPlaceholderText: (
149
149
  placeholder: TextMatch,
150
- options?: ByPlaceholderTextOptions
150
+ options?: ByPlaceholderTextOptions,
151
151
  ) => ReactTestInstance;
152
152
  getAllByPlaceholderText: (
153
153
  placeholder: TextMatch,
154
- options?: ByPlaceholderTextOptions
154
+ options?: ByPlaceholderTextOptions,
155
155
  ) => Array<ReactTestInstance>;
156
156
  queryByPlaceholderText: (
157
157
  placeholder: TextMatch,
158
- options?: ByPlaceholderTextOptions
158
+ options?: ByPlaceholderTextOptions,
159
159
  ) => ReactTestInstance | null;
160
160
  queryAllByPlaceholderText: (
161
161
  placeholder: TextMatch,
162
- options?: ByPlaceholderTextOptions
162
+ options?: ByPlaceholderTextOptions,
163
163
  ) => Array<ReactTestInstance> | [];
164
164
  findByPlaceholderText: (
165
165
  placeholder: TextMatch,
166
166
  queryOptions?: ByPlaceholderTextOptions,
167
- waitForOptions?: WaitForOptions
167
+ waitForOptions?: WaitForOptions,
168
168
  ) => FindReturn;
169
169
  findAllByPlaceholderText: (
170
170
  placeholder: TextMatch,
171
171
  queryOptions?: ByPlaceholderTextOptions,
172
- waitForOptions?: WaitForOptions
172
+ waitForOptions?: WaitForOptions,
173
173
  ) => FindAllReturn;
174
174
  }
175
175
 
@@ -205,12 +205,12 @@ interface A11yAPI {
205
205
  findByLabelText: (
206
206
  matcher: TextMatch,
207
207
  queryOptions?: ByLabelTextOptions,
208
- waitForOptions?: WaitForOptions
208
+ waitForOptions?: WaitForOptions,
209
209
  ) => FindReturn;
210
210
  findAllByLabelText: (
211
211
  matcher: TextMatch,
212
212
  queryOptions?: ByLabelTextOptions,
213
- waitForOptions?: WaitForOptions
213
+ waitForOptions?: WaitForOptions,
214
214
  ) => FindAllReturn;
215
215
 
216
216
  // Hint
@@ -225,22 +225,22 @@ interface A11yAPI {
225
225
  findByA11yHint: (
226
226
  matcher: TextMatch,
227
227
  queryOptions?: ByHintTextOptions,
228
- waitForOptions?: WaitForOptions
228
+ waitForOptions?: WaitForOptions,
229
229
  ) => FindReturn;
230
230
  findByHintText: (
231
231
  matcher: TextMatch,
232
232
  queryOptions?: ByHintTextOptions,
233
- waitForOptions?: WaitForOptions
233
+ waitForOptions?: WaitForOptions,
234
234
  ) => FindReturn;
235
235
  findAllByA11yHint: (
236
236
  matcher: TextMatch,
237
237
  queryOptions?: ByHintTextOptions,
238
- waitForOptions?: WaitForOptions
238
+ waitForOptions?: WaitForOptions,
239
239
  ) => FindAllReturn;
240
240
  findAllByHintText: (
241
241
  matcher: TextMatch,
242
242
  queryOptions?: ByHintTextOptions,
243
- waitForOptions?: WaitForOptions
243
+ waitForOptions?: WaitForOptions,
244
244
  ) => FindAllReturn;
245
245
 
246
246
  // Role
@@ -251,12 +251,12 @@ interface A11yAPI {
251
251
  findByRole: (
252
252
  matcher: A11yRole | RegExp,
253
253
  queryOptions?: ByRoleOptions,
254
- waitForOptions?: WaitForOptions
254
+ waitForOptions?: WaitForOptions,
255
255
  ) => FindReturn;
256
256
  findAllByRole: (
257
257
  matcher: A11yRole | RegExp,
258
258
  queryOptions?: ByRoleOptions,
259
- waitForOptions?: WaitForOptions
259
+ waitForOptions?: WaitForOptions,
260
260
  ) => FindAllReturn;
261
261
  }
262
262
 
@@ -266,7 +266,7 @@ interface Thenable {
266
266
 
267
267
  type MapPropsFunction = (
268
268
  props: { [string]: mixed },
269
- node: ReactTestRendererJSON
269
+ node: ReactTestRendererJSON,
270
270
  ) => { [string]: mixed };
271
271
 
272
272
  type DebugOptions = {
@@ -274,10 +274,6 @@ type DebugOptions = {
274
274
  mapProps?: MapPropsFunction,
275
275
  };
276
276
 
277
- type Debug = {
278
- (options?: DebugOptions | string): void,
279
- };
280
-
281
277
  type Queries = ByTextQueries &
282
278
  ByTestIdQueries &
283
279
  ByDisplayValueQueries &
@@ -304,7 +300,7 @@ declare module '@testing-library/react-native' {
304
300
  rerender(nextElement: React.Element<any>): void;
305
301
  unmount(nextElement?: React.Element<any>): void;
306
302
  toJSON(): ReactTestRendererJSON[] | ReactTestRendererJSON | null;
307
- debug: Debug;
303
+ debug(options?: DebugOptions): void;
308
304
  root: ReactTestInstance;
309
305
  UNSAFE_root: ReactTestInstance;
310
306
  }
@@ -322,7 +318,7 @@ declare module '@testing-library/react-native' {
322
318
 
323
319
  declare export var render: (
324
320
  component: React.Element<any>,
325
- options?: RenderOptions
321
+ options?: RenderOptions,
326
322
  ) => RenderResult;
327
323
 
328
324
  declare export var screen: RenderResult;
@@ -334,7 +330,7 @@ declare module '@testing-library/react-native' {
334
330
 
335
331
  declare type WaitForElementToBeRemovedFunction = <T = any>(
336
332
  expectation: () => T,
337
- options?: WaitForOptions
333
+ options?: WaitForOptions,
338
334
  ) => Promise<T>;
339
335
 
340
336
  declare export var waitForElementToBeRemoved: WaitForElementToBeRemovedFunction;
@@ -375,7 +371,7 @@ declare module '@testing-library/react-native' {
375
371
 
376
372
  declare type RenderHookFunction = <Result, Props>(
377
373
  renderCallback: (props: Props) => Result,
378
- options?: RenderHookOptions<Props>
374
+ options?: RenderHookOptions<Props>,
379
375
  ) => RenderHookResult<Result, Props>;
380
376
 
381
377
  declare export var renderHook: RenderHookFunction;
package/build/index.js CHANGED
@@ -3,6 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ require("./matchers/extend-expect");
7
+ var _act = require("./act");
8
+ var _flushMicroTasks = require("./flush-micro-tasks");
6
9
  var _pure = require("./pure");
7
10
  Object.keys(_pure).forEach(function (key) {
8
11
  if (key === "default" || key === "__esModule") return;
@@ -14,9 +17,6 @@ Object.keys(_pure).forEach(function (key) {
14
17
  }
15
18
  });
16
19
  });
17
- var _flushMicroTasks = require("./flush-micro-tasks");
18
- var _act = require("./act");
19
- require("./matchers/extend-expect");
20
20
  if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
21
21
  // If we're running in a test runner that supports afterEach
22
22
  // then we'll automatically run cleanup afterEach test
@@ -24,7 +24,6 @@ if (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {
24
24
  // if you don't like this then either import the `pure` module
25
25
  // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.
26
26
  if (typeof afterEach === 'function') {
27
- // eslint-disable-next-line no-undef
28
27
  afterEach(async () => {
29
28
  await (0, _flushMicroTasks.flushMicroTasks)();
30
29
  (0, _pure.cleanup)();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_pure","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_flushMicroTasks","_act","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import { cleanup } from './pure';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\nimport './matchers/extend-expect';\n\nif (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {\n // If we're running in a test runner that supports afterEach\n // then we'll automatically run cleanup afterEach test\n // this ensures that tests run in isolation from each other\n // if you don't like this then either import the `pure` module\n // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.\n if (typeof afterEach === 'function') {\n // eslint-disable-next-line no-undef\n afterEach(async () => {\n await flushMicroTasks();\n cleanup();\n });\n }\n\n if (typeof beforeAll === 'function' && typeof afterAll === 'function') {\n // This matches the behavior of React < 18.\n let previousIsReactActEnvironment = getIsReactActEnvironment();\n beforeAll(() => {\n previousIsReactActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(true);\n });\n\n afterAll(() => {\n setReactActEnvironment(previousIsReactActEnvironment);\n });\n }\n}\n\nexport * from './pure';\n"],"mappings":";;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAiCAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AAhCA,IAAAK,gBAAA,GAAAT,OAAA;AACA,IAAAU,IAAA,GAAAV,OAAA;AACAA,OAAA;AAEA,IAAI,CAACW,OAAO,EAAEC,GAAG,EAAEC,sBAAsB,EAAE;EACzC;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnC;IACAA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,EAAC,CAAC;MACvB,IAAAC,aAAO,EAAC,CAAC;IACX,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOC,SAAS,KAAK,UAAU,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IACrE;IACA,IAAIC,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;IAC9DH,SAAS,CAAC,MAAM;MACdE,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;MAC1D,IAAAC,2BAAsB,EAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEFH,QAAQ,CAAC,MAAM;MACb,IAAAG,2BAAsB,EAACF,6BAA6B,CAAC;IACvD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["require","_act","_flushMicroTasks","_pure","Object","keys","forEach","key","exports","defineProperty","enumerable","get","process","env","RNTL_SKIP_AUTO_CLEANUP","afterEach","flushMicroTasks","cleanup","beforeAll","afterAll","previousIsReactActEnvironment","getIsReactActEnvironment","setReactActEnvironment"],"sources":["../src/index.ts"],"sourcesContent":["import './matchers/extend-expect';\n\nimport { getIsReactActEnvironment, setReactActEnvironment } from './act';\nimport { flushMicroTasks } from './flush-micro-tasks';\nimport { cleanup } from './pure';\n\nif (!process?.env?.RNTL_SKIP_AUTO_CLEANUP) {\n // If we're running in a test runner that supports afterEach\n // then we'll automatically run cleanup afterEach test\n // this ensures that tests run in isolation from each other\n // if you don't like this then either import the `pure` module\n // or set the RNTL_SKIP_AUTO_CLEANUP env variable to 'true'.\n if (typeof afterEach === 'function') {\n afterEach(async () => {\n await flushMicroTasks();\n cleanup();\n });\n }\n\n if (typeof beforeAll === 'function' && typeof afterAll === 'function') {\n // This matches the behavior of React < 18.\n let previousIsReactActEnvironment = getIsReactActEnvironment();\n beforeAll(() => {\n previousIsReactActEnvironment = getIsReactActEnvironment();\n setReactActEnvironment(true);\n });\n\n afterAll(() => {\n setReactActEnvironment(previousIsReactActEnvironment);\n });\n }\n}\n\nexport * from './pure';\n"],"mappings":";;;;;AAAAA,OAAA;AAEA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AA6BAI,MAAA,CAAAC,IAAA,CAAAF,KAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,KAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAR,KAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AA3BA,IAAI,CAACK,OAAO,EAAEC,GAAG,EAAEC,sBAAsB,EAAE;EACzC;EACA;EACA;EACA;EACA;EACA,IAAI,OAAOC,SAAS,KAAK,UAAU,EAAE;IACnCA,SAAS,CAAC,YAAY;MACpB,MAAM,IAAAC,gCAAe,EAAC,CAAC;MACvB,IAAAC,aAAO,EAAC,CAAC;IACX,CAAC,CAAC;EACJ;EAEA,IAAI,OAAOC,SAAS,KAAK,UAAU,IAAI,OAAOC,QAAQ,KAAK,UAAU,EAAE;IACrE;IACA,IAAIC,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;IAC9DH,SAAS,CAAC,MAAM;MACdE,6BAA6B,GAAG,IAAAC,6BAAwB,EAAC,CAAC;MAC1D,IAAAC,2BAAsB,EAAC,IAAI,CAAC;IAC9B,CAAC,CAAC;IAEFH,QAAQ,CAAC,MAAM;MACb,IAAAG,2BAAsB,EAACF,6BAA6B,CAAC;IACvD,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- var _toBeOnTheScreen = require("./to-be-on-the-screen");
3
+ var _toBeBusy = require("./to-be-busy");
4
4
  var _toBeChecked = require("./to-be-checked");
5
5
  var _toBeDisabled = require("./to-be-disabled");
6
- var _toBeBusy = require("./to-be-busy");
7
6
  var _toBeEmptyElement = require("./to-be-empty-element");
8
7
  var _toBeExpanded = require("./to-be-expanded");
8
+ var _toBeOnTheScreen = require("./to-be-on-the-screen");
9
9
  var _toBePartiallyChecked = require("./to-be-partially-checked");
10
10
  var _toBeSelected = require("./to-be-selected");
11
11
  var _toBeVisible = require("./to-be-visible");
@@ -1 +1 @@
1
- {"version":3,"file":"extend-expect.js","names":["_toBeOnTheScreen","require","_toBeChecked","_toBeDisabled","_toBeBusy","_toBeEmptyElement","_toBeExpanded","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveAccessibilityValue","_toHaveAccessibleName","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent","expect","extend","toBeOnTheScreen","toBeChecked","toBeCollapsed","toBeDisabled","toBeBusy","toBeEmptyElement","toBeEnabled","toBeExpanded","toBePartiallyChecked","toBeSelected","toBeVisible","toContainElement","toHaveAccessibilityValue","toHaveAccessibleName","toHaveDisplayValue","toHaveProp","toHaveStyle","toHaveTextContent"],"sources":["../../src/matchers/extend-expect.ts"],"sourcesContent":["import { toBeOnTheScreen } from './to-be-on-the-screen';\nimport { toBeChecked } from './to-be-checked';\nimport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nimport { toBeBusy } from './to-be-busy';\nimport { toBeEmptyElement } from './to-be-empty-element';\nimport { toBeExpanded, toBeCollapsed } from './to-be-expanded';\nimport { toBePartiallyChecked } from './to-be-partially-checked';\nimport { toBeSelected } from './to-be-selected';\nimport { toBeVisible } from './to-be-visible';\nimport { toContainElement } from './to-contain-element';\nimport { toHaveAccessibilityValue } from './to-have-accessibility-value';\nimport { toHaveAccessibleName } from './to-have-accessible-name';\nimport { toHaveDisplayValue } from './to-have-display-value';\nimport { toHaveProp } from './to-have-prop';\nimport { toHaveStyle } from './to-have-style';\nimport { toHaveTextContent } from './to-have-text-content';\n\nexport type * from './types';\n\nexpect.extend({\n toBeOnTheScreen,\n toBeChecked,\n toBeCollapsed,\n toBeDisabled,\n toBeBusy,\n toBeEmptyElement,\n toBeEnabled,\n toBeExpanded,\n toBePartiallyChecked,\n toBeSelected,\n toBeVisible,\n toContainElement,\n toHaveAccessibilityValue,\n toHaveAccessibleName,\n toHaveDisplayValue,\n toHaveProp,\n toHaveStyle,\n toHaveTextContent,\n});\n"],"mappings":";;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,yBAAA,GAAAV,OAAA;AACA,IAAAW,qBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA;AAIAgB,MAAM,CAACC,MAAM,CAAC;EACZC,eAAe,EAAfA,gCAAe;EACfC,WAAW,EAAXA,wBAAW;EACXC,aAAa,EAAbA,2BAAa;EACbC,YAAY,EAAZA,0BAAY;EACZC,QAAQ,EAARA,kBAAQ;EACRC,gBAAgB,EAAhBA,kCAAgB;EAChBC,WAAW,EAAXA,yBAAW;EACXC,YAAY,EAAZA,0BAAY;EACZC,oBAAoB,EAApBA,0CAAoB;EACpBC,YAAY,EAAZA,0BAAY;EACZC,WAAW,EAAXA,wBAAW;EACXC,gBAAgB,EAAhBA,kCAAgB;EAChBC,wBAAwB,EAAxBA,kDAAwB;EACxBC,oBAAoB,EAApBA,0CAAoB;EACpBC,kBAAkB,EAAlBA,sCAAkB;EAClBC,UAAU,EAAVA,sBAAU;EACVC,WAAW,EAAXA,wBAAW;EACXC,iBAAiB,EAAjBA;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"extend-expect.js","names":["_toBeBusy","require","_toBeChecked","_toBeDisabled","_toBeEmptyElement","_toBeExpanded","_toBeOnTheScreen","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveAccessibilityValue","_toHaveAccessibleName","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent","expect","extend","toBeOnTheScreen","toBeChecked","toBeCollapsed","toBeDisabled","toBeBusy","toBeEmptyElement","toBeEnabled","toBeExpanded","toBePartiallyChecked","toBeSelected","toBeVisible","toContainElement","toHaveAccessibilityValue","toHaveAccessibleName","toHaveDisplayValue","toHaveProp","toHaveStyle","toHaveTextContent"],"sources":["../../src/matchers/extend-expect.ts"],"sourcesContent":["import { toBeBusy } from './to-be-busy';\nimport { toBeChecked } from './to-be-checked';\nimport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nimport { toBeEmptyElement } from './to-be-empty-element';\nimport { toBeCollapsed, toBeExpanded } from './to-be-expanded';\nimport { toBeOnTheScreen } from './to-be-on-the-screen';\nimport { toBePartiallyChecked } from './to-be-partially-checked';\nimport { toBeSelected } from './to-be-selected';\nimport { toBeVisible } from './to-be-visible';\nimport { toContainElement } from './to-contain-element';\nimport { toHaveAccessibilityValue } from './to-have-accessibility-value';\nimport { toHaveAccessibleName } from './to-have-accessible-name';\nimport { toHaveDisplayValue } from './to-have-display-value';\nimport { toHaveProp } from './to-have-prop';\nimport { toHaveStyle } from './to-have-style';\nimport { toHaveTextContent } from './to-have-text-content';\n\nexport type * from './types';\n\nexpect.extend({\n toBeOnTheScreen,\n toBeChecked,\n toBeCollapsed,\n toBeDisabled,\n toBeBusy,\n toBeEmptyElement,\n toBeEnabled,\n toBeExpanded,\n toBePartiallyChecked,\n toBeSelected,\n toBeVisible,\n toContainElement,\n toHaveAccessibilityValue,\n toHaveAccessibleName,\n toHaveDisplayValue,\n toHaveProp,\n toHaveStyle,\n toHaveTextContent,\n});\n"],"mappings":";;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,yBAAA,GAAAV,OAAA;AACA,IAAAW,qBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA;AAIAgB,MAAM,CAACC,MAAM,CAAC;EACZC,eAAe,EAAfA,gCAAe;EACfC,WAAW,EAAXA,wBAAW;EACXC,aAAa,EAAbA,2BAAa;EACbC,YAAY,EAAZA,0BAAY;EACZC,QAAQ,EAARA,kBAAQ;EACRC,gBAAgB,EAAhBA,kCAAgB;EAChBC,WAAW,EAAXA,yBAAW;EACXC,YAAY,EAAZA,0BAAY;EACZC,oBAAoB,EAApBA,0CAAoB;EACpBC,YAAY,EAAZA,0BAAY;EACZC,WAAW,EAAXA,wBAAW;EACXC,gBAAgB,EAAhBA,kCAAgB;EAChBC,wBAAwB,EAAxBA,kDAAwB;EACxBC,oBAAoB,EAApBA,0CAAoB;EACpBC,kBAAkB,EAAlBA,sCAAkB;EAClBC,UAAU,EAAVA,sBAAU;EACVC,WAAW,EAAXA,wBAAW;EACXC,iBAAiB,EAAjBA;AACF,CAAC,CAAC","ignoreList":[]}
@@ -2,7 +2,7 @@ export { toBeBusy } from './to-be-busy';
2
2
  export { toBeChecked } from './to-be-checked';
3
3
  export { toBeDisabled, toBeEnabled } from './to-be-disabled';
4
4
  export { toBeEmptyElement } from './to-be-empty-element';
5
- export { toBeExpanded, toBeCollapsed } from './to-be-expanded';
5
+ export { toBeCollapsed, toBeExpanded } from './to-be-expanded';
6
6
  export { toBeOnTheScreen } from './to-be-on-the-screen';
7
7
  export { toBePartiallyChecked } from './to-be-partially-checked';
8
8
  export { toBeSelected } from './to-be-selected';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_toBeBusy","require","_toBeChecked","_toBeDisabled","_toBeEmptyElement","_toBeExpanded","_toBeOnTheScreen","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveAccessibilityValue","_toHaveAccessibleName","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent"],"sources":["../../src/matchers/index.ts"],"sourcesContent":["export { toBeBusy } from './to-be-busy';\nexport { toBeChecked } from './to-be-checked';\nexport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nexport { toBeEmptyElement } from './to-be-empty-element';\nexport { toBeExpanded, toBeCollapsed } from './to-be-expanded';\nexport { toBeOnTheScreen } from './to-be-on-the-screen';\nexport { toBePartiallyChecked } from './to-be-partially-checked';\nexport { toBeSelected } from './to-be-selected';\nexport { toBeVisible } from './to-be-visible';\nexport { toContainElement } from './to-contain-element';\nexport { toHaveAccessibilityValue } from './to-have-accessibility-value';\nexport { toHaveAccessibleName } from './to-have-accessible-name';\nexport { toHaveDisplayValue } from './to-have-display-value';\nexport { toHaveProp } from './to-have-prop';\nexport { toHaveStyle } from './to-have-style';\nexport { toHaveTextContent } from './to-have-text-content';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,yBAAA,GAAAV,OAAA;AACA,IAAAW,qBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["_toBeBusy","require","_toBeChecked","_toBeDisabled","_toBeEmptyElement","_toBeExpanded","_toBeOnTheScreen","_toBePartiallyChecked","_toBeSelected","_toBeVisible","_toContainElement","_toHaveAccessibilityValue","_toHaveAccessibleName","_toHaveDisplayValue","_toHaveProp","_toHaveStyle","_toHaveTextContent"],"sources":["../../src/matchers/index.ts"],"sourcesContent":["export { toBeBusy } from './to-be-busy';\nexport { toBeChecked } from './to-be-checked';\nexport { toBeDisabled, toBeEnabled } from './to-be-disabled';\nexport { toBeEmptyElement } from './to-be-empty-element';\nexport { toBeCollapsed, toBeExpanded } from './to-be-expanded';\nexport { toBeOnTheScreen } from './to-be-on-the-screen';\nexport { toBePartiallyChecked } from './to-be-partially-checked';\nexport { toBeSelected } from './to-be-selected';\nexport { toBeVisible } from './to-be-visible';\nexport { toContainElement } from './to-contain-element';\nexport { toHaveAccessibilityValue } from './to-have-accessibility-value';\nexport { toHaveAccessibleName } from './to-have-accessible-name';\nexport { toHaveDisplayValue } from './to-have-display-value';\nexport { toHaveProp } from './to-have-prop';\nexport { toHaveStyle } from './to-have-style';\nexport { toHaveTextContent } from './to-have-text-content';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,qBAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,iBAAA,GAAAT,OAAA;AACA,IAAAU,yBAAA,GAAAV,OAAA;AACA,IAAAW,qBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AACA,IAAAa,WAAA,GAAAb,OAAA;AACA,IAAAc,YAAA,GAAAd,OAAA;AACA,IAAAe,kBAAA,GAAAf,OAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import type { ReactTestInstance } from 'react-test-renderer';
2
2
  export declare function toBeBusy(this: jest.MatcherContext, element: ReactTestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeBusy = toBeBusy;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _accessibility = require("../helpers/accessibility");
10
+ var _formatElement = require("../helpers/format-element");
9
11
  var _utils = require("./utils");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
13
  function toBeBusy(element) {
11
14
  (0, _utils.checkHostElement)(element, toBeBusy, this);
12
15
  return {
13
16
  pass: (0, _accessibility.computeAriaBusy)(element),
14
17
  message: () => {
15
18
  const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');
16
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}busy:`, (0, _utils.formatElement)(element)].join('\n');
19
+ return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}busy:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
17
20
  }
18
21
  };
19
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeBusy","element","checkHostElement","pass","computeAriaBusy","message","matcher","matcherHint","isNot","formatElement","join"],"sources":["../../src/matchers/to-be-busy.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { computeAriaBusy } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: computeAriaBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,QAAQA,CAA4BC,OAA0B,EAAE;EAC9E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,8BAAe,EAACH,OAAO,CAAC;IAC9BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;MAClF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,OAAO,EACtD,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-busy.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeBusy","element","checkHostElement","pass","computeAriaBusy","message","matcher","matcherHint","isNot","redent","formatElement","join"],"sources":["../../src/matchers/to-be-busy.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\n\nimport { computeAriaBusy } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeBusy(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeBusy, this);\n\n return {\n pass: computeAriaBusy(element),\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeBusy`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}busy:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,QAAQA,CAA4BC,OAA0B,EAAE;EAC9E,IAAAC,uBAAgB,EAACD,OAAO,EAAED,QAAQ,EAAE,IAAI,CAAC;EAEzC,OAAO;IACLG,IAAI,EAAE,IAAAC,8BAAe,EAACH,OAAO,CAAC;IAC9BI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,CAAC;MAClF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,OAAO,EACtD,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeChecked = toBeChecked;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _accessibility = require("../helpers/accessibility");
9
10
  var _errors = require("../helpers/errors");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _hostComponentNames = require("../helpers/host-component-names");
11
13
  var _utils = require("./utils");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
15
  function toBeChecked(element) {
13
16
  (0, _utils.checkHostElement)(element, toBeChecked, this);
14
17
  if (!(0, _hostComponentNames.isHostSwitch)(element) && !isSupportedAccessibilityElement(element)) {
@@ -18,7 +21,7 @@ function toBeChecked(element) {
18
21
  pass: (0, _accessibility.computeAriaChecked)(element) === true,
19
22
  message: () => {
20
23
  const is = this.isNot ? 'is' : 'is not';
21
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''), '', `Received element ${is} checked:`, (0, _utils.formatElement)(element)].join('\n');
24
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''), '', `Received element ${is} checked:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
22
25
  }
23
26
  };
24
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_accessibility","_errors","_hostComponentNames","_utils","toBeChecked","element","checkHostElement","isHostSwitch","isSupportedAccessibilityElement","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","formatElement","join","isAccessibilityElement","role","getRole","rolesSupportingCheckedState"],"sources":["../../src/matchers/to-be-checked.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport {\n computeAriaChecked,\n getRole,\n isAccessibilityElement,\n rolesSupportingCheckedState,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { isHostSwitch } from '../helpers/host-component-names';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeChecked, this);\n\n if (!isHostSwitch(element) && !isSupportedAccessibilityElement(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on host \"Switch\" elements or accessibility elements with \"checkbox\", \"radio\" or \"switch\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isSupportedAccessibilityElement(element: ReactTestInstance) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getRole(element);\n return rolesSupportingCheckedState[role];\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,mBAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAEO,SAASK,WAAWA,CAA4BC,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAAC,IAAAG,gCAAY,EAACF,OAAO,CAAC,IAAI,CAACG,+BAA+B,CAACH,OAAO,CAAC,EAAE;IACvE,MAAM,IAAII,sBAAc,CACtB,yHAAyH,EACzHL,WACF,CAAC;EACH;EAEA,OAAO;IACLM,IAAI,EAAE,IAAAC,iCAAkB,EAACN,OAAO,CAAC,KAAK,IAAI;IAC1CO,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACX,OAAO,CAAC,CACvB,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAAST,+BAA+BA,CAACH,OAA0B,EAAE;EACnE,IAAI,CAAC,IAAAa,qCAAsB,EAACb,OAAO,CAAC,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,MAAMc,IAAI,GAAG,IAAAC,sBAAO,EAACf,OAAO,CAAC;EAC7B,OAAOgB,0CAA2B,CAACF,IAAI,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"file":"to-be-checked.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_errors","_formatElement","_hostComponentNames","_utils","e","__esModule","default","toBeChecked","element","checkHostElement","isHostSwitch","isSupportedAccessibilityElement","ErrorWithStack","pass","computeAriaChecked","message","is","isNot","matcherHint","redent","formatElement","join","isAccessibilityElement","role","getRole","rolesSupportingCheckedState"],"sources":["../../src/matchers/to-be-checked.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\n\nimport {\n computeAriaChecked,\n getRole,\n isAccessibilityElement,\n rolesSupportingCheckedState,\n} from '../helpers/accessibility';\nimport { ErrorWithStack } from '../helpers/errors';\nimport { formatElement } from '../helpers/format-element';\nimport { isHostSwitch } from '../helpers/host-component-names';\nimport { checkHostElement } from './utils';\n\nexport function toBeChecked(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeChecked, this);\n\n if (!isHostSwitch(element) && !isSupportedAccessibilityElement(element)) {\n throw new ErrorWithStack(\n `toBeChecked() works only on host \"Switch\" elements or accessibility elements with \"checkbox\", \"radio\" or \"switch\" role.`,\n toBeChecked,\n );\n }\n\n return {\n pass: computeAriaChecked(element) === true,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeChecked`, 'element', ''),\n '',\n `Received element ${is} checked:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction isSupportedAccessibilityElement(element: ReactTestInstance) {\n if (!isAccessibilityElement(element)) {\n return false;\n }\n\n const role = getRole(element);\n return rolesSupportingCheckedState[role];\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AAMA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,mBAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAA2C,SAAAE,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,WAAWA,CAA4BC,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,WAAW,EAAE,IAAI,CAAC;EAE5C,IAAI,CAAC,IAAAG,gCAAY,EAACF,OAAO,CAAC,IAAI,CAACG,+BAA+B,CAACH,OAAO,CAAC,EAAE;IACvE,MAAM,IAAII,sBAAc,CACtB,yHAAyH,EACzHL,WACF,CAAC;EACH;EAEA,OAAO;IACLM,IAAI,EAAE,IAAAC,iCAAkB,EAACN,OAAO,CAAC,KAAK,IAAI;IAC1CO,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACZ,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACa,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASV,+BAA+BA,CAACH,OAA0B,EAAE;EACnE,IAAI,CAAC,IAAAc,qCAAsB,EAACd,OAAO,CAAC,EAAE;IACpC,OAAO,KAAK;EACd;EAEA,MAAMe,IAAI,GAAG,IAAAC,sBAAO,EAAChB,OAAO,CAAC;EAC7B,OAAOiB,0CAA2B,CAACF,IAAI,CAAC;AAC1C","ignoreList":[]}
@@ -6,9 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.toBeDisabled = toBeDisabled;
7
7
  exports.toBeEnabled = toBeEnabled;
8
8
  var _jestMatcherUtils = require("jest-matcher-utils");
9
+ var _redent = _interopRequireDefault(require("redent"));
9
10
  var _accessibility = require("../helpers/accessibility");
10
11
  var _componentTree = require("../helpers/component-tree");
12
+ var _formatElement = require("../helpers/format-element");
11
13
  var _utils = require("./utils");
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
15
  function toBeDisabled(element) {
13
16
  (0, _utils.checkHostElement)(element, toBeDisabled, this);
14
17
  const isDisabled = (0, _accessibility.computeAriaDisabled)(element) || isAncestorDisabled(element);
@@ -16,7 +19,7 @@ function toBeDisabled(element) {
16
19
  pass: isDisabled,
17
20
  message: () => {
18
21
  const is = this.isNot ? 'is' : 'is not';
19
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''), '', `Received element ${is} disabled:`, (0, _utils.formatElement)(element)].join('\n');
22
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''), '', `Received element ${is} disabled:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
20
23
  }
21
24
  };
22
25
  }
@@ -27,7 +30,7 @@ function toBeEnabled(element) {
27
30
  pass: isEnabled,
28
31
  message: () => {
29
32
  const is = this.isNot ? 'is' : 'is not';
30
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''), '', `Received element ${is} enabled:`, (0, _utils.formatElement)(element)].join('\n');
33
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''), '', `Received element ${is} enabled:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
31
34
  }
32
35
  };
33
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-disabled.js","names":["_jestMatcherUtils","require","_accessibility","_componentTree","_utils","toBeDisabled","element","checkHostElement","isDisabled","computeAriaDisabled","isAncestorDisabled","pass","message","is","isNot","matcherHint","formatElement","join","toBeEnabled","isEnabled","parent","getHostParent"],"sources":["../../src/matchers/to-be-disabled.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { computeAriaDisabled } from '../helpers/accessibility';\nimport { getHostParent } from '../helpers/component-tree';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeDisabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeDisabled, this);\n\n const isDisabled = computeAriaDisabled(element) || isAncestorDisabled(element);\n\n return {\n pass: isDisabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''),\n '',\n `Received element ${is} disabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeEnabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEnabled, this);\n\n const isEnabled = !computeAriaDisabled(element) && !isAncestorDisabled(element);\n\n return {\n pass: isEnabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''),\n '',\n `Received element ${is} enabled:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nfunction isAncestorDisabled(element: ReactTestInstance): boolean {\n const parent = getHostParent(element);\n if (parent == null) {\n return false;\n }\n\n return computeAriaDisabled(parent) || isAncestorDisabled(parent);\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,MAAMG,UAAU,GAAG,IAAAC,kCAAmB,EAACH,OAAO,CAAC,IAAII,kBAAkB,CAACJ,OAAO,CAAC;EAE9E,OAAO;IACLK,IAAI,EAAEH,UAAU;IAChBI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC,EACtE,EAAE,EACF,oBAAoBD,EAAE,YAAY,EAClC,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,WAAWA,CAA4BZ,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAEY,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMC,SAAS,GAAG,CAAC,IAAAV,kCAAmB,EAACH,OAAO,CAAC,IAAI,CAACI,kBAAkB,CAACJ,OAAO,CAAC;EAE/E,OAAO;IACLK,IAAI,EAAEQ,SAAS;IACfP,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,oBAAa,EAACV,OAAO,CAAC,CACvB,CAACW,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASP,kBAAkBA,CAACJ,OAA0B,EAAW;EAC/D,MAAMc,MAAM,GAAG,IAAAC,4BAAa,EAACf,OAAO,CAAC;EACrC,IAAIc,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,KAAK;EACd;EAEA,OAAO,IAAAX,kCAAmB,EAACW,MAAM,CAAC,IAAIV,kBAAkB,CAACU,MAAM,CAAC;AAClE","ignoreList":[]}
1
+ {"version":3,"file":"to-be-disabled.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_componentTree","_formatElement","_utils","e","__esModule","default","toBeDisabled","element","checkHostElement","isDisabled","computeAriaDisabled","isAncestorDisabled","pass","message","is","isNot","matcherHint","redent","formatElement","join","toBeEnabled","isEnabled","parent","getHostParent"],"sources":["../../src/matchers/to-be-disabled.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\n\nimport { computeAriaDisabled } from '../helpers/accessibility';\nimport { getHostParent } from '../helpers/component-tree';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeDisabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeDisabled, this);\n\n const isDisabled = computeAriaDisabled(element) || isAncestorDisabled(element);\n\n return {\n pass: isDisabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeDisabled`, 'element', ''),\n '',\n `Received element ${is} disabled:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeEnabled(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEnabled, this);\n\n const isEnabled = !computeAriaDisabled(element) && !isAncestorDisabled(element);\n\n return {\n pass: isEnabled,\n message: () => {\n const is = this.isNot ? 'is' : 'is not';\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEnabled`, 'element', ''),\n '',\n `Received element ${is} enabled:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nfunction isAncestorDisabled(element: ReactTestInstance): boolean {\n const parent = getHostParent(element);\n if (parent == null) {\n return false;\n }\n\n return computeAriaDisabled(parent) || isAncestorDisabled(parent);\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA2C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,MAAMG,UAAU,GAAG,IAAAC,kCAAmB,EAACH,OAAO,CAAC,IAAII,kBAAkB,CAACJ,OAAO,CAAC;EAE9E,OAAO;IACLK,IAAI,EAAEH,UAAU;IAChBI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC,EACtE,EAAE,EACF,oBAAoBD,EAAE,YAAY,EAClC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACX,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,WAAWA,CAA4Bb,OAA0B,EAAE;EACjF,IAAAC,uBAAgB,EAACD,OAAO,EAAEa,WAAW,EAAE,IAAI,CAAC;EAE5C,MAAMC,SAAS,GAAG,CAAC,IAAAX,kCAAmB,EAACH,OAAO,CAAC,IAAI,CAACI,kBAAkB,CAACJ,OAAO,CAAC;EAE/E,OAAO;IACLK,IAAI,EAAES,SAAS;IACfR,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,EAAE,GAAG,IAAI,CAACC,KAAK,GAAG,IAAI,GAAG,QAAQ;MACvC,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACD,KAAK,GAAG,MAAM,GAAG,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC,EACrE,EAAE,EACF,oBAAoBD,EAAE,WAAW,EACjC,IAAAG,eAAM,EAAC,IAAAC,4BAAa,EAACX,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACY,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEA,SAASR,kBAAkBA,CAACJ,OAA0B,EAAW;EAC/D,MAAMe,MAAM,GAAG,IAAAC,4BAAa,EAAChB,OAAO,CAAC;EACrC,IAAIe,MAAM,IAAI,IAAI,EAAE;IAClB,OAAO,KAAK;EACd;EAEA,OAAO,IAAAZ,kCAAmB,EAACY,MAAM,CAAC,IAAIX,kBAAkB,CAACW,MAAM,CAAC;AAClE","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import type { ReactTestInstance } from 'react-test-renderer';
2
2
  export declare function toBeEmptyElement(this: jest.MatcherContext, element: ReactTestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeEmptyElement = toBeEmptyElement;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _componentTree = require("../helpers/component-tree");
10
+ var _formatElement = require("../helpers/format-element");
9
11
  var _utils = require("./utils");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
13
  function toBeEmptyElement(element) {
11
14
  (0, _utils.checkHostElement)(element, toBeEmptyElement, this);
12
15
  const hostChildren = (0, _componentTree.getHostChildren)(element);
13
16
  return {
14
17
  pass: hostChildren.length === 0,
15
18
  message: () => {
16
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''), '', 'Received:', `${(0, _jestMatcherUtils.RECEIVED_COLOR)((0, _utils.formatElementArray)(hostChildren))}`].join('\n');
19
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''), '', 'Received:', `${(0, _jestMatcherUtils.RECEIVED_COLOR)((0, _redent.default)((0, _formatElement.formatElementList)(hostChildren), 2))}`].join('\n');
17
20
  }
18
21
  };
19
22
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_componentTree","_utils","toBeEmptyElement","element","checkHostElement","hostChildren","getHostChildren","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","formatElementArray","join"],"sources":["../../src/matchers/to-be-empty-element.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getHostChildren } from '../helpers/component-tree';\nimport { checkHostElement, formatElementArray } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEmptyElement, this);\n\n const hostChildren = getHostChildren(element);\n\n return {\n pass: hostChildren.length === 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''),\n '',\n 'Received:',\n `${RECEIVED_COLOR(formatElementArray(hostChildren))}`,\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,gBAAgBA,CAA4BC,OAA0B,EAAE;EACtF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEjD,MAAMG,YAAY,GAAG,IAAAC,8BAAe,EAACH,OAAO,CAAC;EAE7C,OAAO;IACLI,IAAI,EAAEF,YAAY,CAACG,MAAM,KAAK,CAAC;IAC/BC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC1E,EAAE,EACF,WAAW,EACX,GAAG,IAAAC,gCAAc,EAAC,IAAAC,yBAAkB,EAACR,YAAY,CAAC,CAAC,EAAE,CACtD,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-empty-element.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_componentTree","_formatElement","_utils","e","__esModule","default","toBeEmptyElement","element","checkHostElement","hostChildren","getHostChildren","pass","length","message","matcherHint","isNot","RECEIVED_COLOR","redent","formatElementList","join"],"sources":["../../src/matchers/to-be-empty-element.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\n\nimport { getHostChildren } from '../helpers/component-tree';\nimport { formatElementList } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeEmptyElement(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeEmptyElement, this);\n\n const hostChildren = getHostChildren(element);\n\n return {\n pass: hostChildren.length === 0,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeEmptyElement`, 'element', ''),\n '',\n 'Received:',\n `${RECEIVED_COLOR(redent(formatElementList(hostChildren), 2))}`,\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,gBAAgBA,CAA4BC,OAA0B,EAAE;EACtF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,gBAAgB,EAAE,IAAI,CAAC;EAEjD,MAAMG,YAAY,GAAG,IAAAC,8BAAe,EAACH,OAAO,CAAC;EAE7C,OAAO;IACLI,IAAI,EAAEF,YAAY,CAACG,MAAM,KAAK,CAAC;IAC/BC,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,mBAAmB,EAAE,SAAS,EAAE,EAAE,CAAC,EAC1E,EAAE,EACF,WAAW,EACX,GAAG,IAAAC,gCAAc,EAAC,IAAAC,eAAM,EAAC,IAAAC,gCAAiB,EAACT,YAAY,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAChE,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ReactTestInstance } from 'react-test-renderer';
1
+ import type { ReactTestInstance } from 'react-test-renderer';
2
2
  export declare function toBeExpanded(this: jest.MatcherContext, element: ReactTestInstance): {
3
3
  pass: boolean;
4
4
  message: () => string;
@@ -6,15 +6,18 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.toBeCollapsed = toBeCollapsed;
7
7
  exports.toBeExpanded = toBeExpanded;
8
8
  var _jestMatcherUtils = require("jest-matcher-utils");
9
+ var _redent = _interopRequireDefault(require("redent"));
9
10
  var _accessibility = require("../helpers/accessibility");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  function toBeExpanded(element) {
12
15
  (0, _utils.checkHostElement)(element, toBeExpanded, this);
13
16
  return {
14
17
  pass: (0, _accessibility.computeAriaExpanded)(element) === true,
15
18
  message: () => {
16
19
  const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');
17
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}expanded:`, (0, _utils.formatElement)(element)].join('\n');
20
+ return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}expanded:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
18
21
  }
19
22
  };
20
23
  }
@@ -24,7 +27,7 @@ function toBeCollapsed(element) {
24
27
  pass: (0, _accessibility.computeAriaExpanded)(element) === false,
25
28
  message: () => {
26
29
  const matcher = (0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');
27
- return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}collapsed:`, (0, _utils.formatElement)(element)].join('\n');
30
+ return [matcher, '', `Received element is ${this.isNot ? '' : 'not '}collapsed:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
28
31
  }
29
32
  };
30
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-expanded.js","names":["_jestMatcherUtils","require","_accessibility","_utils","toBeExpanded","element","checkHostElement","pass","computeAriaExpanded","message","matcher","matcherHint","isNot","formatElement","join","toBeCollapsed"],"sources":["../../src/matchers/to-be-expanded.ts"],"sourcesContent":["import { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport { computeAriaExpanded } from '../helpers/accessibility';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeExpanded(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeExpanded, this);\n\n return {\n pass: computeAriaExpanded(element) === true,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}expanded:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeCollapsed(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeCollapsed, this);\n\n return {\n pass: computeAriaExpanded(element) === false,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}collapsed:`,\n formatElement(element),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAEO,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,kCAAmB,EAACH,OAAO,CAAC,KAAK,IAAI;IAC3CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC;MACtF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,WAAW,EAC1D,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,aAAaA,CAA4BV,OAA0B,EAAE;EACnF,IAAAC,uBAAgB,EAACD,OAAO,EAAEU,aAAa,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLR,IAAI,EAAE,IAAAC,kCAAmB,EAACH,OAAO,CAAC,KAAK,KAAK;IAC5CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,CAAC;MACvF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,YAAY,EAC3D,IAAAC,oBAAa,EAACR,OAAO,CAAC,CACvB,CAACS,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-expanded.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_accessibility","_formatElement","_utils","e","__esModule","default","toBeExpanded","element","checkHostElement","pass","computeAriaExpanded","message","matcher","matcherHint","isNot","redent","formatElement","join","toBeCollapsed"],"sources":["../../src/matchers/to-be-expanded.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint } from 'jest-matcher-utils';\nimport redent from 'redent';\n\nimport { computeAriaExpanded } from '../helpers/accessibility';\nimport { formatElement } from '../helpers/format-element';\nimport { checkHostElement } from './utils';\n\nexport function toBeExpanded(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeExpanded, this);\n\n return {\n pass: computeAriaExpanded(element) === true,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeExpanded`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}expanded:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n\nexport function toBeCollapsed(this: jest.MatcherContext, element: ReactTestInstance) {\n checkHostElement(element, toBeCollapsed, this);\n\n return {\n pass: computeAriaExpanded(element) === false,\n message: () => {\n const matcher = matcherHint(`${this.isNot ? '.not' : ''}.toBeCollapsed`, 'element', '');\n return [\n matcher,\n '',\n `Received element is ${this.isNot ? '' : 'not '}collapsed:`,\n redent(formatElement(element), 2),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAA2C,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,YAAYA,CAA4BC,OAA0B,EAAE;EAClF,IAAAC,uBAAgB,EAACD,OAAO,EAAED,YAAY,EAAE,IAAI,CAAC;EAE7C,OAAO;IACLG,IAAI,EAAE,IAAAC,kCAAmB,EAACH,OAAO,CAAC,KAAK,IAAI;IAC3CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC;MACtF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,WAAW,EAC1D,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH;AAEO,SAASC,aAAaA,CAA4BX,OAA0B,EAAE;EACnF,IAAAC,uBAAgB,EAACD,OAAO,EAAEW,aAAa,EAAE,IAAI,CAAC;EAE9C,OAAO;IACLT,IAAI,EAAE,IAAAC,kCAAmB,EAACH,OAAO,CAAC,KAAK,KAAK;IAC5CI,OAAO,EAAEA,CAAA,KAAM;MACb,MAAMC,OAAO,GAAG,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACC,KAAK,GAAG,MAAM,GAAG,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE,CAAC;MACvF,OAAO,CACLF,OAAO,EACP,EAAE,EACF,uBAAuB,IAAI,CAACE,KAAK,GAAG,EAAE,GAAG,MAAM,YAAY,EAC3D,IAAAC,eAAM,EAAC,IAAAC,4BAAa,EAACT,OAAO,CAAC,EAAE,CAAC,CAAC,CAClC,CAACU,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -5,16 +5,19 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBeOnTheScreen = toBeOnTheScreen;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _componentTree = require("../helpers/component-tree");
10
+ var _formatElement = require("../helpers/format-element");
9
11
  var _screen = require("../screen");
10
12
  var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  function toBeOnTheScreen(element) {
12
15
  if (element !== null || !this.isNot) {
13
16
  (0, _utils.checkHostElement)(element, toBeOnTheScreen, this);
14
17
  }
15
18
  const pass = element === null ? false : _screen.screen.UNSAFE_root === (0, _componentTree.getUnsafeRootElement)(element);
16
19
  const errorFound = () => {
17
- return `expected element tree not to contain element, but found\n${(0, _utils.formatElement)(element)}`;
20
+ return `expected element tree not to contain element, but found\n${(0, _redent.default)((0, _formatElement.formatElement)(element), 2)}`;
18
21
  };
19
22
  const errorNotFound = () => {
20
23
  return `element could not be found in the element tree`;
@@ -1 +1 @@
1
- {"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_componentTree","_screen","_utils","toBeOnTheScreen","element","isNot","checkHostElement","pass","screen","UNSAFE_root","getUnsafeRootElement","errorFound","formatElement","errorNotFound","message","matcherHint","RECEIVED_COLOR","join"],"sources":["../../src/matchers/to-be-on-the-screen.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport { getUnsafeRootElement } from '../helpers/component-tree';\nimport { screen } from '../screen';\nimport { checkHostElement, formatElement } from './utils';\n\nexport function toBeOnTheScreen(this: jest.MatcherContext, element: ReactTestInstance) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeOnTheScreen, this);\n }\n\n const pass = element === null ? false : screen.UNSAFE_root === getUnsafeRootElement(element);\n\n const errorFound = () => {\n return `expected element tree not to contain element, but found\\n${formatElement(element)}`;\n };\n\n const errorNotFound = () => {\n return `element could not be found in the element tree`;\n };\n\n return {\n pass,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'element', ''),\n '',\n RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound()),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEO,SAASI,eAAeA,CAA4BC,OAA0B,EAAE;EACrF,IAAIA,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACnC,IAAAC,uBAAgB,EAACF,OAAO,EAAED,eAAe,EAAE,IAAI,CAAC;EAClD;EAEA,MAAMI,IAAI,GAAGH,OAAO,KAAK,IAAI,GAAG,KAAK,GAAGI,cAAM,CAACC,WAAW,KAAK,IAAAC,mCAAoB,EAACN,OAAO,CAAC;EAE5F,MAAMO,UAAU,GAAGA,CAAA,KAAM;IACvB,OAAO,4DAA4D,IAAAC,oBAAa,EAACR,OAAO,CAAC,EAAE;EAC7F,CAAC;EAED,MAAMS,aAAa,GAAGA,CAAA,KAAM;IAC1B,OAAO,gDAAgD;EACzD,CAAC;EAED,OAAO;IACLN,IAAI;IACJO,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACV,KAAK,GAAG,MAAM,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,CAAC,EACzE,EAAE,EACF,IAAAW,gCAAc,EAAC,IAAI,CAACX,KAAK,GAAGM,UAAU,CAAC,CAAC,GAAGE,aAAa,CAAC,CAAC,CAAC,CAC5D,CAACI,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"to-be-on-the-screen.js","names":["_jestMatcherUtils","require","_redent","_interopRequireDefault","_componentTree","_formatElement","_screen","_utils","e","__esModule","default","toBeOnTheScreen","element","isNot","checkHostElement","pass","screen","UNSAFE_root","getUnsafeRootElement","errorFound","redent","formatElement","errorNotFound","message","matcherHint","RECEIVED_COLOR","join"],"sources":["../../src/matchers/to-be-on-the-screen.ts"],"sourcesContent":["import type { ReactTestInstance } from 'react-test-renderer';\nimport { matcherHint, RECEIVED_COLOR } from 'jest-matcher-utils';\nimport redent from 'redent';\n\nimport { getUnsafeRootElement } from '../helpers/component-tree';\nimport { formatElement } from '../helpers/format-element';\nimport { screen } from '../screen';\nimport { checkHostElement } from './utils';\n\nexport function toBeOnTheScreen(this: jest.MatcherContext, element: ReactTestInstance) {\n if (element !== null || !this.isNot) {\n checkHostElement(element, toBeOnTheScreen, this);\n }\n\n const pass = element === null ? false : screen.UNSAFE_root === getUnsafeRootElement(element);\n\n const errorFound = () => {\n return `expected element tree not to contain element, but found\\n${redent(\n formatElement(element),\n 2,\n )}`;\n };\n\n const errorNotFound = () => {\n return `element could not be found in the element tree`;\n };\n\n return {\n pass,\n message: () => {\n return [\n matcherHint(`${this.isNot ? '.not' : ''}.toBeOnTheScreen`, 'element', ''),\n '',\n RECEIVED_COLOR(this.isNot ? errorFound() : errorNotFound()),\n ].join('\\n');\n },\n };\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAA2C,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpC,SAASG,eAAeA,CAA4BC,OAA0B,EAAE;EACrF,IAAIA,OAAO,KAAK,IAAI,IAAI,CAAC,IAAI,CAACC,KAAK,EAAE;IACnC,IAAAC,uBAAgB,EAACF,OAAO,EAAED,eAAe,EAAE,IAAI,CAAC;EAClD;EAEA,MAAMI,IAAI,GAAGH,OAAO,KAAK,IAAI,GAAG,KAAK,GAAGI,cAAM,CAACC,WAAW,KAAK,IAAAC,mCAAoB,EAACN,OAAO,CAAC;EAE5F,MAAMO,UAAU,GAAGA,CAAA,KAAM;IACvB,OAAO,4DAA4D,IAAAC,eAAM,EACvE,IAAAC,4BAAa,EAACT,OAAO,CAAC,EACtB,CACF,CAAC,EAAE;EACL,CAAC;EAED,MAAMU,aAAa,GAAGA,CAAA,KAAM;IAC1B,OAAO,gDAAgD;EACzD,CAAC;EAED,OAAO;IACLP,IAAI;IACJQ,OAAO,EAAEA,CAAA,KAAM;MACb,OAAO,CACL,IAAAC,6BAAW,EAAC,GAAG,IAAI,CAACX,KAAK,GAAG,MAAM,GAAG,EAAE,kBAAkB,EAAE,SAAS,EAAE,EAAE,CAAC,EACzE,EAAE,EACF,IAAAY,gCAAc,EAAC,IAAI,CAACZ,KAAK,GAAGM,UAAU,CAAC,CAAC,GAAGG,aAAa,CAAC,CAAC,CAAC,CAC5D,CAACI,IAAI,CAAC,IAAI,CAAC;IACd;EACF,CAAC;AACH","ignoreList":[]}
@@ -5,9 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toBePartiallyChecked = toBePartiallyChecked;
7
7
  var _jestMatcherUtils = require("jest-matcher-utils");
8
+ var _redent = _interopRequireDefault(require("redent"));
8
9
  var _accessibility = require("../helpers/accessibility");
9
10
  var _errors = require("../helpers/errors");
11
+ var _formatElement = require("../helpers/format-element");
10
12
  var _utils = require("./utils");
13
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
14
  function toBePartiallyChecked(element) {
12
15
  (0, _utils.checkHostElement)(element, toBePartiallyChecked, this);
13
16
  if (!hasValidAccessibilityRole(element)) {
@@ -17,7 +20,7 @@ function toBePartiallyChecked(element) {
17
20
  pass: (0, _accessibility.computeAriaChecked)(element) === 'mixed',
18
21
  message: () => {
19
22
  const is = this.isNot ? 'is' : 'is not';
20
- return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''), '', `Received element ${is} partially checked:`, (0, _utils.formatElement)(element)].join('\n');
23
+ return [(0, _jestMatcherUtils.matcherHint)(`${this.isNot ? '.not' : ''}.toBePartiallyChecked`, 'element', ''), '', `Received element ${is} partially checked:`, (0, _redent.default)((0, _formatElement.formatElement)(element), 2)].join('\n');
21
24
  }
22
25
  };
23
26
  }