@najemi-software/vitest-dom 1.0.1 → 1.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 (108) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/esm/index.d.ts +18 -3
  3. package/esm/index.d.ts.map +1 -1
  4. package/esm/index.js +1 -0
  5. package/esm/index.js.map +1 -1
  6. package/esm/matchers/to-be-checked.d.ts +8 -1
  7. package/esm/matchers/to-be-checked.d.ts.map +1 -1
  8. package/esm/matchers/to-be-checked.js +8 -1
  9. package/esm/matchers/to-be-checked.js.map +1 -1
  10. package/esm/matchers/to-be-disabled.d.ts +10 -2
  11. package/esm/matchers/to-be-disabled.d.ts.map +1 -1
  12. package/esm/matchers/to-be-disabled.js +10 -2
  13. package/esm/matchers/to-be-disabled.js.map +1 -1
  14. package/esm/matchers/to-be-empty-dom-element.d.ts +2 -1
  15. package/esm/matchers/to-be-empty-dom-element.d.ts.map +1 -1
  16. package/esm/matchers/to-be-empty-dom-element.js +2 -1
  17. package/esm/matchers/to-be-empty-dom-element.js.map +1 -1
  18. package/esm/matchers/to-be-empty.d.ts +5 -2
  19. package/esm/matchers/to-be-empty.d.ts.map +1 -1
  20. package/esm/matchers/to-be-empty.js +5 -2
  21. package/esm/matchers/to-be-empty.js.map +1 -1
  22. package/esm/matchers/to-be-in-the-document.d.ts +2 -1
  23. package/esm/matchers/to-be-in-the-document.d.ts.map +1 -1
  24. package/esm/matchers/to-be-in-the-document.js +2 -1
  25. package/esm/matchers/to-be-in-the-document.js.map +1 -1
  26. package/esm/matchers/to-be-in-the-dom.d.ts +6 -3
  27. package/esm/matchers/to-be-in-the-dom.d.ts.map +1 -1
  28. package/esm/matchers/to-be-in-the-dom.js +6 -3
  29. package/esm/matchers/to-be-in-the-dom.js.map +1 -1
  30. package/esm/matchers/to-be-invalid.d.ts +16 -2
  31. package/esm/matchers/to-be-invalid.d.ts.map +1 -1
  32. package/esm/matchers/to-be-invalid.js +16 -2
  33. package/esm/matchers/to-be-invalid.js.map +1 -1
  34. package/esm/matchers/to-be-partially-checked.d.ts +7 -1
  35. package/esm/matchers/to-be-partially-checked.d.ts.map +1 -1
  36. package/esm/matchers/to-be-partially-checked.js +7 -1
  37. package/esm/matchers/to-be-partially-checked.js.map +1 -1
  38. package/esm/matchers/to-be-required.d.ts +8 -1
  39. package/esm/matchers/to-be-required.d.ts.map +1 -1
  40. package/esm/matchers/to-be-required.js +8 -1
  41. package/esm/matchers/to-be-required.js.map +1 -1
  42. package/esm/matchers/to-be-visible.d.ts +2 -1
  43. package/esm/matchers/to-be-visible.d.ts.map +1 -1
  44. package/esm/matchers/to-be-visible.js +2 -1
  45. package/esm/matchers/to-be-visible.js.map +1 -1
  46. package/esm/matchers/to-contain-element.d.ts +2 -1
  47. package/esm/matchers/to-contain-element.d.ts.map +1 -1
  48. package/esm/matchers/to-contain-element.js +2 -1
  49. package/esm/matchers/to-contain-element.js.map +1 -1
  50. package/esm/matchers/to-contain-html.d.ts +2 -1
  51. package/esm/matchers/to-contain-html.d.ts.map +1 -1
  52. package/esm/matchers/to-contain-html.js +2 -1
  53. package/esm/matchers/to-contain-html.js.map +1 -1
  54. package/esm/matchers/to-have-accessible-description.d.ts +2 -1
  55. package/esm/matchers/to-have-accessible-description.d.ts.map +1 -1
  56. package/esm/matchers/to-have-accessible-description.js +2 -1
  57. package/esm/matchers/to-have-accessible-description.js.map +1 -1
  58. package/esm/matchers/to-have-accessible-errormessage.d.ts +6 -1
  59. package/esm/matchers/to-have-accessible-errormessage.d.ts.map +1 -1
  60. package/esm/matchers/to-have-accessible-errormessage.js +6 -1
  61. package/esm/matchers/to-have-accessible-errormessage.js.map +1 -1
  62. package/esm/matchers/to-have-accessible-name.d.ts +2 -1
  63. package/esm/matchers/to-have-accessible-name.d.ts.map +1 -1
  64. package/esm/matchers/to-have-accessible-name.js +2 -1
  65. package/esm/matchers/to-have-accessible-name.js.map +1 -1
  66. package/esm/matchers/to-have-attribute.d.ts +8 -1
  67. package/esm/matchers/to-have-attribute.d.ts.map +1 -1
  68. package/esm/matchers/to-have-attribute.js +8 -1
  69. package/esm/matchers/to-have-attribute.js.map +1 -1
  70. package/esm/matchers/to-have-class.d.ts +12 -3
  71. package/esm/matchers/to-have-class.d.ts.map +1 -1
  72. package/esm/matchers/to-have-class.js +8 -1
  73. package/esm/matchers/to-have-class.js.map +1 -1
  74. package/esm/matchers/to-have-description.d.ts +10 -3
  75. package/esm/matchers/to-have-description.d.ts.map +1 -1
  76. package/esm/matchers/to-have-description.js +10 -3
  77. package/esm/matchers/to-have-description.js.map +1 -1
  78. package/esm/matchers/to-have-display-value.d.ts +7 -1
  79. package/esm/matchers/to-have-display-value.d.ts.map +1 -1
  80. package/esm/matchers/to-have-display-value.js +7 -1
  81. package/esm/matchers/to-have-display-value.js.map +1 -1
  82. package/esm/matchers/to-have-errormessage.d.ts +3 -3
  83. package/esm/matchers/to-have-errormessage.js +3 -3
  84. package/esm/matchers/to-have-focus.d.ts +2 -1
  85. package/esm/matchers/to-have-focus.d.ts.map +1 -1
  86. package/esm/matchers/to-have-focus.js +2 -1
  87. package/esm/matchers/to-have-focus.js.map +1 -1
  88. package/esm/matchers/to-have-form-values.d.ts +8 -1
  89. package/esm/matchers/to-have-form-values.d.ts.map +1 -1
  90. package/esm/matchers/to-have-form-values.js +8 -1
  91. package/esm/matchers/to-have-form-values.js.map +1 -1
  92. package/esm/matchers/to-have-style.d.ts +8 -1
  93. package/esm/matchers/to-have-style.d.ts.map +1 -1
  94. package/esm/matchers/to-have-style.js +8 -1
  95. package/esm/matchers/to-have-style.js.map +1 -1
  96. package/esm/matchers/to-have-text-content.d.ts +2 -1
  97. package/esm/matchers/to-have-text-content.d.ts.map +1 -1
  98. package/esm/matchers/to-have-text-content.js +2 -1
  99. package/esm/matchers/to-have-text-content.js.map +1 -1
  100. package/esm/matchers/to-have-value.d.ts +2 -1
  101. package/esm/matchers/to-have-value.d.ts.map +1 -1
  102. package/esm/matchers/to-have-value.js +2 -1
  103. package/esm/matchers/to-have-value.js.map +1 -1
  104. package/esm/matchers/types.d.ts +15 -0
  105. package/esm/matchers/types.d.ts.map +1 -1
  106. package/esm/tsdoc-metadata.json +11 -0
  107. package/esm/vitest-dom.d.ts +882 -0
  108. package/package.json +4 -2
@@ -0,0 +1,882 @@
1
+ import type { expect } from 'vitest';
2
+ import type { ExpectStatic } from 'vitest';
3
+
4
+ /**
5
+ * @public
6
+ */
7
+ export declare type ExpectationResult = IMatcherResult | Promise<IMatcherResult>;
8
+
9
+ /**
10
+ * @public
11
+ */
12
+ export declare interface IMatcherFn<State extends MatcherState, Args extends unknown[] = any[]> {
13
+ (this: State, received: any, ...args: Args): ExpectationResult;
14
+ }
15
+
16
+ /**
17
+ * @public
18
+ */
19
+ export declare interface IMatcherResult {
20
+ pass: boolean;
21
+ message(): string;
22
+ actual?: unknown;
23
+ expected?: unknown;
24
+ meta?: object;
25
+ }
26
+
27
+ /**
28
+ * @public
29
+ */
30
+ export declare interface IToHaveClassOptions {
31
+ exact: boolean;
32
+ }
33
+
34
+ /**
35
+ * @public
36
+ */
37
+ export declare type MatcherArgs<F> = F extends IMatcherFn<MatcherState, infer Args> ? Args : never;
38
+
39
+ declare namespace matchers {
40
+ export {
41
+ toBeChecked,
42
+ toBeDisabled,
43
+ toBeEnabled,
44
+ toBeEmptyDOMElement,
45
+ toBeEmpty,
46
+ toBeInTheDocument,
47
+ toBeInTheDOM,
48
+ toBeInvalid,
49
+ toBeValid,
50
+ toBePartiallyChecked,
51
+ toBeRequired,
52
+ toBeVisible,
53
+ toContainElement,
54
+ toContainHTML,
55
+ toHaveAccessibleDescription,
56
+ toHaveAccessibleErrorMessage,
57
+ toHaveAccessibleName,
58
+ toHaveAttribute,
59
+ toHaveClass,
60
+ toHaveDescription,
61
+ toHaveDisplayValue,
62
+ toHaveErrorMessage,
63
+ toHaveFocus,
64
+ toHaveFormValues,
65
+ toHaveStyle,
66
+ toHaveTextContent,
67
+ toHaveValue
68
+ }
69
+ }
70
+ export { matchers }
71
+
72
+ /**
73
+ * @public
74
+ */
75
+ export declare type MatcherState = ReturnType<ExpectStatic["getState"]>;
76
+
77
+ /**
78
+ * @public
79
+ */
80
+ export declare type TestingLibraryMatchers<R> = {
81
+ [K in keyof typeof matchers]: (...args: MatcherArgs<(typeof matchers)[K]>) => R;
82
+ };
83
+
84
+ /**
85
+ * Assert whether the given element is checked.
86
+ *
87
+ * It accepts an `input` of type `checkbox` or `radio` and elements with a `role` of `radio` with a valid
88
+ * `aria-checked` attribute of "true" or "false".
89
+ *
90
+ * @example
91
+ * ```html
92
+ * <input
93
+ * type="checkbox"
94
+ * checked
95
+ * data-testid="input-checkbox" />
96
+ * <input
97
+ * type="radio"
98
+ * value="foo"
99
+ * data-testid="input-radio" />
100
+ * ```
101
+ *
102
+ * ```ts
103
+ * const inputCheckbox = getByTestId('input-checkbox')
104
+ * const inputRadio = getByTestId('input-radio')
105
+ * expect(inputCheckbox).toBeChecked()
106
+ * expect(inputRadio).not.toBeChecked()
107
+ * ```
108
+ *
109
+ * @see
110
+ * [testing-library/jest-dom#tobechecked](https://github.com/testing-library/jest-dom#tobechecked)
111
+ *
112
+ * @public
113
+ */
114
+ export declare function toBeChecked(this: MatcherState, element: Element): IMatcherResult;
115
+
116
+ /**
117
+ * Allows you to check whether an element is disabled from the user's perspective.
118
+ *
119
+ * Matches if the element is a form control and the `disabled` attribute is specified on this element or the
120
+ * element is a descendant of a form element with a `disabled` attribute.
121
+ *
122
+ * @example
123
+ * ```html
124
+ * <button
125
+ * data-testid="button"
126
+ * type="submit"
127
+ * disabled
128
+ * >
129
+ * submit
130
+ * </button>
131
+ * ```
132
+ *
133
+ * ```ts
134
+ * expect(getByTestId('button')).toBeDisabled()
135
+ * ```
136
+ *
137
+ * @see
138
+ * [testing-library/jest-dom#tobedisabled](https://github.com/testing-library/jest-dom#tobedisabled)
139
+ *
140
+ * @public
141
+ */
142
+ export declare function toBeDisabled(this: MatcherState, element: Element): IMatcherResult;
143
+
144
+ /**
145
+ * Assert whether an element has content or not.
146
+ *
147
+ * @deprecated
148
+ * since v5.9.0
149
+ *
150
+ * @example
151
+ * <span data-testid="not-empty">
152
+ * <span data-testid="empty"></span>
153
+ * </span>
154
+ *
155
+ * expect(getByTestId('empty')).toBeEmpty()
156
+ * expect(getByTestId('not-empty')).not.toBeEmpty()
157
+ * @see
158
+ * [testing-library/jest-dom#tobeempty](https://github.com/testing-library/jest-dom#tobeempty)
159
+ *
160
+ * @public
161
+ */
162
+ export declare function toBeEmpty(this: MatcherState, element: Element): IMatcherResult;
163
+
164
+ /**
165
+ * Assert whether an element has content or not.
166
+ * @example
167
+ * <span data-testid="not-empty">
168
+ * <span data-testid="empty"></span>
169
+ * </span>
170
+ *
171
+ * expect(getByTestId('empty')).toBeEmptyDOMElement()
172
+ * expect(getByTestId('not-empty')).not.toBeEmptyDOMElement()
173
+ * @see
174
+ * [testing-library/jest-dom#tobeemptydomelement](https://github.com/testing-library/jest-dom#tobeemptydomelement)
175
+ *
176
+ * @public
177
+ */
178
+ export declare function toBeEmptyDOMElement(this: MatcherState, element: Element): IMatcherResult;
179
+
180
+ /**
181
+ * Allows you to check whether an element is not disabled from the user's perspective.
182
+ *
183
+ * Works like `not.toBeDisabled()`.
184
+ *
185
+ * Use this matcher to avoid double negation in your tests.
186
+ * @example
187
+ * <button
188
+ * data-testid="button"
189
+ * type="submit"
190
+ * >
191
+ * submit
192
+ * </button>
193
+ *
194
+ * expect(getByTestId('button')).toBeEnabled()
195
+ * @see
196
+ * [testing-library/jest-dom#tobeenabled](https://github.com/testing-library/jest-dom#tobeenabled)
197
+ *
198
+ * @public
199
+ */
200
+ export declare function toBeEnabled(this: MatcherState, element: Element): IMatcherResult;
201
+
202
+ /**
203
+ * Assert whether an element is present in the document or not.
204
+ * @example
205
+ * <svg data-testid="svg-element"></svg>
206
+ *
207
+ * expect(queryByTestId('svg-element')).toBeInTheDocument()
208
+ * expect(queryByTestId('does-not-exist')).not.toBeInTheDocument()
209
+ * @see
210
+ * [testing-library/jest-dom#tobeinthedocument](https://github.com/testing-library/jest-dom#tobeinthedocument)
211
+ *
212
+ * @public
213
+ */
214
+ export declare function toBeInTheDocument(this: MatcherState, element: Element): IMatcherResult;
215
+
216
+ /**
217
+ * Assert whether a value is a DOM element, or not. Contrary to what its name
218
+ * implies, this matcher only checks that you passed to it a valid DOM
219
+ * element.
220
+ *
221
+ * It does not have a clear definition of what "the DOM" is. Therefore, it
222
+ * does not check whether that element is contained anywhere.
223
+ *
224
+ * @deprecated
225
+ * since v1.9.0
226
+ *
227
+ * @see [testing-library/jest-dom#toBeInTheDom](https://github.com/testing-library/jest-dom#toBeInTheDom)
228
+ *
229
+ * @public
230
+ */
231
+ export declare function toBeInTheDOM(this: MatcherState, element: Element, container?: HTMLElement | SVGElement): IMatcherResult;
232
+
233
+ /**
234
+ * Check if a form element, or the entire `form`, is currently invalid.
235
+ *
236
+ * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no
237
+ * value or a value of "true", or if the result of `checkValidity()` is false.
238
+ *
239
+ * @example
240
+ * ```html
241
+ * <input data-testid="no-aria-invalid" />
242
+ *
243
+ * <form data-testid="invalid-form">
244
+ * <input required />
245
+ * </form>
246
+ * ```
247
+ *
248
+ * ```ts
249
+ * expect(getByTestId('no-aria-invalid')).not.toBeInvalid()
250
+ * expect(getByTestId('invalid-form')).toBeInvalid()
251
+ * ```
252
+ *
253
+ * @see
254
+ * [testing-library/jest-dom#tobeinvalid](https://github.com/testing-library/jest-dom#tobeinvalid)
255
+ *
256
+ * @public
257
+ */
258
+ export declare function toBeInvalid(this: MatcherState, element: Element): IMatcherResult;
259
+
260
+ /**
261
+ * This allows you to check whether the given element is partially checked.
262
+ * It accepts an input of type checkbox and elements with a role of checkbox
263
+ * with a aria-checked="mixed", or input of type checkbox with indeterminate
264
+ * set to true
265
+ *
266
+ * @example
267
+ * ```html
268
+ * <input type="checkbox" aria-checked="mixed" data-testid="aria-checkbox-mixed" />
269
+ * <input type="checkbox" checked data-testid="input-checkbox-checked" />
270
+ * <input type="checkbox" data-testid="input-checkbox-unchecked" />
271
+ * <div role="checkbox" aria-checked="true" data-testid="aria-checkbox-checked" />
272
+ * <div
273
+ * role="checkbox"
274
+ * aria-checked="false"
275
+ * data-testid="aria-checkbox-unchecked"
276
+ * />
277
+ * <input type="checkbox" data-testid="input-checkbox-indeterminate" />
278
+ * ```
279
+ *
280
+ * ```ts
281
+ * const ariaCheckboxMixed = getByTestId('aria-checkbox-mixed')
282
+ * const inputCheckboxChecked = getByTestId('input-checkbox-checked')
283
+ * const inputCheckboxUnchecked = getByTestId('input-checkbox-unchecked')
284
+ * const ariaCheckboxChecked = getByTestId('aria-checkbox-checked')
285
+ * const ariaCheckboxUnchecked = getByTestId('aria-checkbox-unchecked')
286
+ * const inputCheckboxIndeterminate = getByTestId('input-checkbox-indeterminate')
287
+ *
288
+ * expect(ariaCheckboxMixed).toBePartiallyChecked()
289
+ * expect(inputCheckboxChecked).not.toBePartiallyChecked()
290
+ * expect(inputCheckboxUnchecked).not.toBePartiallyChecked()
291
+ * expect(ariaCheckboxChecked).not.toBePartiallyChecked()
292
+ * expect(ariaCheckboxUnchecked).not.toBePartiallyChecked()
293
+ *
294
+ * inputCheckboxIndeterminate.indeterminate = true
295
+ * expect(inputCheckboxIndeterminate).toBePartiallyChecked()
296
+ * ```
297
+ *
298
+ * @see
299
+ * [testing-library/jest-dom#tobepartiallychecked](https://github.com/testing-library/jest-dom#tobepartiallychecked)
300
+ *
301
+ * @public
302
+ */
303
+ export declare function toBePartiallyChecked(this: MatcherState, element: Element): IMatcherResult;
304
+
305
+ /**
306
+ * This allows you to check if a form element is currently required.
307
+ *
308
+ * An element is required if it is having a `required` or `aria-required="true"` attribute.
309
+ *
310
+ * @example
311
+ * ```html
312
+ * <input data-testid="required-input" required />
313
+ * <div
314
+ * data-testid="supported-role"
315
+ * role="tree"
316
+ * required />
317
+ * ```
318
+ *
319
+ * ```ts
320
+ * expect(getByTestId('required-input')).toBeRequired()
321
+ * expect(getByTestId('supported-role')).not.toBeRequired()
322
+ * ```
323
+ *
324
+ * @see
325
+ * [testing-library/jest-dom#toberequired](https://github.com/testing-library/jest-dom#toberequired)
326
+ *
327
+ * @public
328
+ */
329
+ export declare function toBeRequired(this: MatcherState, element: Element): IMatcherResult;
330
+
331
+ /**
332
+ * Allows you to check if a form element is currently required.
333
+ *
334
+ * An `input`, `select`, `textarea`, or `form` element is invalid if it has an `aria-invalid` attribute with no
335
+ * value or a value of "false", or if the result of `checkValidity()` is true.
336
+ *
337
+ * @example
338
+ * ```html
339
+ * <input data-testid="aria-invalid" aria-invalid />
340
+ *
341
+ * <form data-testid="valid-form">
342
+ * <input />
343
+ * </form>
344
+ * ```
345
+ *
346
+ * ```ts
347
+ * expect(getByTestId('no-aria-invalid')).not.toBeValid()
348
+ * expect(getByTestId('invalid-form')).toBeInvalid()
349
+ * ```
350
+ *
351
+ * @see
352
+ * [testing-library/jest-dom#tobevalid](https://github.com/testing-library/jest-dom#tobevalid)
353
+ *
354
+ * @public
355
+ */
356
+ export declare function toBeValid(this: MatcherState, element: Element): IMatcherResult;
357
+
358
+ /**
359
+ * This allows you to check if an element is currently visible to the user.
360
+ *
361
+ * An element is visible if **all** the following conditions are met:
362
+ * * it does not have its css property display set to none
363
+ * * it does not have its css property visibility set to either hidden or collapse
364
+ * * it does not have its css property opacity set to 0
365
+ * * its parent element is also visible (and so on up to the top of the DOM tree)
366
+ * * it does not have the hidden attribute
367
+ * * if `<details />` it has the open attribute
368
+ * @example
369
+ * <div
370
+ * data-testid="zero-opacity"
371
+ * style="opacity: 0"
372
+ * >
373
+ * Zero Opacity
374
+ * </div>
375
+ *
376
+ * <div data-testid="visible">Visible Example</div>
377
+ *
378
+ * expect(getByTestId('zero-opacity')).not.toBeVisible()
379
+ * expect(getByTestId('visible')).toBeVisible()
380
+ * @see
381
+ * [testing-library/jest-dom#tobevisible](https://github.com/testing-library/jest-dom#tobevisible)
382
+ *
383
+ * @public
384
+ */
385
+ export declare function toBeVisible(this: MatcherState, element: Element): IMatcherResult;
386
+
387
+ /**
388
+ * Allows you to assert whether an element contains another element as a descendant or not.
389
+ * @example
390
+ * <span data-testid="ancestor">
391
+ * <span data-testid="descendant"></span>
392
+ * </span>
393
+ *
394
+ * const ancestor = getByTestId('ancestor')
395
+ * const descendant = getByTestId('descendant')
396
+ * const nonExistantElement = getByTestId('does-not-exist')
397
+ * expect(ancestor).toContainElement(descendant)
398
+ * expect(descendant).not.toContainElement(ancestor)
399
+ * expect(ancestor).not.toContainElement(nonExistantElement)
400
+ * @see
401
+ * [testing-library/jest-dom#tocontainelement](https://github.com/testing-library/jest-dom#tocontainelement)
402
+ *
403
+ * @public
404
+ */
405
+ export declare function toContainElement(this: MatcherState, container: Element, element: HTMLElement | SVGElement | null): IMatcherResult;
406
+
407
+ /**
408
+ * Assert whether a string representing a HTML element is contained in another element.
409
+ * @example
410
+ * <span data-testid="parent"><span data-testid="child"></span></span>
411
+ *
412
+ * expect(getByTestId('parent')).toContainHTML('<span data-testid="child"></span>')
413
+ * @see
414
+ * [testing-library/jest-dom#tocontainhtml](https://github.com/testing-library/jest-dom#tocontainhtml)
415
+ *
416
+ * @public
417
+ */
418
+ export declare function toContainHTML(this: MatcherState, container: Element, htmlText: string): IMatcherResult;
419
+
420
+ /**
421
+ * This allows to assert that an element has the expected [accessible description](https://w3c.github.io/accname/).
422
+ *
423
+ * You can pass the exact string of the expected accessible description, or you can make a
424
+ * partial match passing a regular expression, or by using either
425
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring)
426
+ * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
427
+ * @example
428
+ * <a data-testid="link" href="/" aria-label="Home page" title="A link to start over">Start</a>
429
+ * <a data-testid="extra-link" href="/about" aria-label="About page">About</a>
430
+ * <img src="avatar.jpg" data-testid="avatar" alt="User profile pic" />
431
+ * <img src="logo.jpg" data-testid="logo" alt="Company logo" aria-describedby="t1" />
432
+ * <span id="t1" role="presentation">The logo of Our Company</span>
433
+ *
434
+ * expect(getByTestId('link')).toHaveAccessibleDescription()
435
+ * expect(getByTestId('link')).toHaveAccessibleDescription('A link to start over')
436
+ * expect(getByTestId('link')).not.toHaveAccessibleDescription('Home page')
437
+ * expect(getByTestId('extra-link')).not.toHaveAccessibleDescription()
438
+ * expect(getByTestId('avatar')).not.toHaveAccessibleDescription()
439
+ * expect(getByTestId('logo')).not.toHaveAccessibleDescription('Company logo')
440
+ * expect(getByTestId('logo')).toHaveAccessibleDescription('The logo of Our Company')
441
+ * @see
442
+ * [testing-library/jest-dom#tohaveaccessibledescription](https://github.com/testing-library/jest-dom#tohaveaccessibledescription)
443
+ *
444
+ * @public
445
+ */
446
+ export declare function toHaveAccessibleDescription(this: MatcherState, htmlElement: Element, expectedAccessibleDescription?: string | RegExp | typeof expect.stringContaining): IMatcherResult;
447
+
448
+ /**
449
+ * This allows you to assert that an element has the expected
450
+ * [accessible error message](https://w3c.github.io/aria/#aria-errormessage).
451
+ *
452
+ * You can pass the exact string of the expected accessible error message.
453
+ * Alternatively, you can perform a partial match by passing a regular expression
454
+ * or by using either
455
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring)
456
+ * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
457
+ *
458
+ * @example
459
+ * ```html
460
+ * <input aria-label="Has Error" aria-invalid="true" aria-errormessage="error-message" />
461
+ * <div id="error-message" role="alert">This field is invalid</div>
462
+ *
463
+ * <input aria-label="No Error Attributes" />
464
+ * <input aria-label="Not Invalid" aria-invalid="false" aria-errormessage="error-message" />
465
+ * ```
466
+ *
467
+ * ```ts
468
+ * // Inputs with Valid Error Messages
469
+ * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage()
470
+ * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage('This field is invalid')
471
+ * expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage(/invalid/i)
472
+ * expect(
473
+ * getByRole('textbox', {name: 'Has Error'}),
474
+ * ).not.toHaveAccessibleErrorMessage('This field is absolutely correct!')
475
+ *
476
+ * // Inputs without Valid Error Messages
477
+ * expect(
478
+ * getByRole('textbox', {name: 'No Error Attributes'}),
479
+ * ).not.toHaveAccessibleErrorMessage()
480
+ *
481
+ * expect(
482
+ * getByRole('textbox', {name: 'Not Invalid'}),
483
+ * ).not.toHaveAccessibleErrorMessage()
484
+ * ```
485
+ *
486
+ * @see
487
+ * [testing-library/jest-dom#tohaveaccessibleerrormessage](https://github.com/testing-library/jest-dom#tohaveaccessibleerrormessage)
488
+ *
489
+ * @public
490
+ */
491
+ export declare function toHaveAccessibleErrorMessage<State extends MatcherState>(this: State, htmlElement: Element, expectedAccessibleErrorMessage?: string | RegExp | State): IMatcherResult;
492
+
493
+ /**
494
+ * This allows to assert that an element has the expected [accessible name](https://w3c.github.io/accname/).
495
+ * It is useful, for instance, to assert that form elements and buttons are properly labelled.
496
+ *
497
+ * You can pass the exact string of the expected accessible name, or you can make a
498
+ * partial match passing a regular expression, or by using either
499
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring)
500
+ * or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
501
+ * @example
502
+ * <img data-testid="img-alt" src="" alt="Test alt" />
503
+ * <img data-testid="img-empty-alt" src="" alt="" />
504
+ * <svg data-testid="svg-title"><title>Test title</title></svg>
505
+ * <button data-testid="button-img-alt"><img src="" alt="Test" /></button>
506
+ * <p><img data-testid="img-paragraph" src="" alt="" /> Test content</p>
507
+ * <button data-testid="svg-button"><svg><title>Test</title></svg></p>
508
+ * <div><svg data-testid="svg-without-title"></svg></div>
509
+ * <input data-testid="input-title" title="test" />
510
+ *
511
+ * expect(getByTestId('img-alt')).toHaveAccessibleName('Test alt')
512
+ * expect(getByTestId('img-empty-alt')).not.toHaveAccessibleName()
513
+ * expect(getByTestId('svg-title')).toHaveAccessibleName('Test title')
514
+ * expect(getByTestId('button-img-alt')).toHaveAccessibleName()
515
+ * expect(getByTestId('img-paragraph')).not.toHaveAccessibleName()
516
+ * expect(getByTestId('svg-button')).toHaveAccessibleName()
517
+ * expect(getByTestId('svg-without-title')).not.toHaveAccessibleName()
518
+ * expect(getByTestId('input-title')).toHaveAccessibleName()
519
+ * @see
520
+ * [testing-library/jest-dom#tohaveaccessiblename](https://github.com/testing-library/jest-dom#tohaveaccessiblename)
521
+ *
522
+ * @public
523
+ */
524
+ export declare function toHaveAccessibleName(this: MatcherState, htmlElement: Element, expectedAccessibleName?: string | RegExp | typeof expect.stringContaining): IMatcherResult;
525
+
526
+ /**
527
+ * Allows you to check if a given element has an attribute or not.
528
+ *
529
+ * You can also optionally check that the attribute has a specific expected value or partial match using
530
+ * [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) or
531
+ * [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
532
+ *
533
+ * @example
534
+ * ```html
535
+ * <button
536
+ * data-testid="ok-button"
537
+ * type="submit"
538
+ * disabled
539
+ * >
540
+ * ok
541
+ * </button>
542
+ * ```
543
+ *
544
+ * ```ts
545
+ * expect(button).toHaveAttribute('disabled')
546
+ * expect(button).toHaveAttribute('type', 'submit')
547
+ * expect(button).not.toHaveAttribute('type', 'button')
548
+ * ```
549
+ *
550
+ * @see
551
+ * [testing-library/jest-dom#tohaveattribute](https://github.com/testing-library/jest-dom#tohaveattribute)
552
+ *
553
+ * @public
554
+ */
555
+ export declare function toHaveAttribute(this: MatcherState, htmlElement: Element, name: string, expectedValue?: unknown): IMatcherResult;
556
+
557
+ /**
558
+ * Check whether the given element has certain classes within its `class` attribute.
559
+ *
560
+ * You must provide at least one class, unless you are asserting that an element does not have any classes.
561
+ *
562
+ * @example
563
+ * ```html
564
+ * <button
565
+ * data-testid="delete-button"
566
+ * class="btn xs btn-danger"
567
+ * >
568
+ * delete item
569
+ * </button>
570
+ *
571
+ * <div data-testid="no-classes">no classes</div>
572
+ * ```
573
+ *
574
+ * ```ts
575
+ * const deleteButton = getByTestId('delete-button')
576
+ * const noClasses = getByTestId('no-classes')
577
+ * expect(deleteButton).toHaveClass('btn')
578
+ * expect(deleteButton).toHaveClass('btn-danger xs')
579
+ * expect(deleteButton).toHaveClass('btn xs btn-danger', {exact: true})
580
+ * expect(deleteButton).not.toHaveClass('btn xs btn-danger', {exact: true})
581
+ * expect(noClasses).not.toHaveClass()
582
+ * ```
583
+ *
584
+ * @see
585
+ * [testing-library/jest-dom#tohaveclass](https://github.com/testing-library/jest-dom#tohaveclass)
586
+ *
587
+ * @public
588
+ */
589
+ export declare function toHaveClass(this: MatcherState, htmlElement: Element, ...params: string[] | [classNames: string, options?: IToHaveClassOptions] | [...classNames: string[], options: IToHaveClassOptions]): IMatcherResult;
590
+
591
+ /**
592
+ * Check the accessible description for an element.
593
+ * This allows you to check whether the given element has a description or not.
594
+ *
595
+ * An element gets its description via the
596
+ * [`aria-describedby` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
597
+ * Set this to the `id` of one or more other elements. These elements may be nested
598
+ * inside, be outside, or a sibling of the passed in element.
599
+ *
600
+ * Whitespace is normalized. Using multiple ids will
601
+ * [join the referenced elements’ text content separated by a space](https://www.w3.org/TR/accname-1.1/#mapping_additional_nd_description).
602
+ *
603
+ * When a `string` argument is passed through, it will perform a whole
604
+ * case-sensitive match to the description text.
605
+ *
606
+ * To perform a case-insensitive match, you can use a `RegExp` with the `/i`
607
+ * modifier.
608
+ *
609
+ * To perform a partial match, you can pass a `RegExp` or use
610
+ * `expect.stringContaining("partial string")`.
611
+ *
612
+ * @deprecated
613
+ * since v5.14.1
614
+ *
615
+ * @example
616
+ * ```html
617
+ * <button aria-label="Close" aria-describedby="description-close">
618
+ * X
619
+ * </button>
620
+ * <div id="description-close">
621
+ * Closing will discard any changes
622
+ * </div>
623
+ *
624
+ * <button>Delete</button>
625
+ * ```
626
+ *
627
+ * ```ts
628
+ * const closeButton = getByRole('button', {name: 'Close'})
629
+ *
630
+ * expect(closeButton).toHaveDescription('Closing will discard any changes')
631
+ * expect(closeButton).toHaveDescription(/will discard/) // to partially match
632
+ * expect(closeButton).toHaveDescription(expect.stringContaining('will discard')) // to partially match
633
+ * expect(closeButton).toHaveDescription(/^closing/i) // to use case-insensitive match
634
+ * expect(closeButton).not.toHaveDescription('Other description')
635
+ *
636
+ * const deleteButton = getByRole('button', {name: 'Delete'})
637
+ * expect(deleteButton).not.toHaveDescription()
638
+ * expect(deleteButton).toHaveDescription('') // Missing or empty description always becomes a blank string
639
+ * ```
640
+ *
641
+ * @see
642
+ * [testing-library/jest-dom#tohavedescription](https://github.com/testing-library/jest-dom#tohavedescription)
643
+ *
644
+ * @public
645
+ */
646
+ export declare function toHaveDescription(this: MatcherState, htmlElement: Element, checkWith?: string | RegExp | typeof expect.stringContaining): IMatcherResult;
647
+
648
+ /**
649
+ * This allows you to check whether the given form element has the specified displayed value (the one the
650
+ * end user will see). It accepts <input>, <select> and <textarea> elements with the exception of <input type="checkbox">
651
+ * and <input type="radio">, which can be meaningfully matched only using toBeChecked or toHaveFormValues.
652
+ *
653
+ * @example
654
+ * ```html
655
+ * <label for="input-example">First name</label>
656
+ * <input type="text" id="input-example" value="Luca" />
657
+ *
658
+ * <label for="textarea-example">Description</label>
659
+ * <textarea id="textarea-example">An example description here.</textarea>
660
+ *
661
+ * <label for="single-select-example">Fruit</label>
662
+ * <select id="single-select-example">
663
+ * <option value="">Select a fruit...</option>
664
+ * <option value="banana">Banana</option>
665
+ * <option value="ananas">Ananas</option>
666
+ * <option value="avocado">Avocado</option>
667
+ * </select>
668
+ *
669
+ * <label for="mutiple-select-example">Fruits</label>
670
+ * <select id="multiple-select-example" multiple>
671
+ * <option value="">Select a fruit...</option>
672
+ * <option value="banana" selected>Banana</option>
673
+ * <option value="ananas">Ananas</option>
674
+ * <option value="avocado" selected>Avocado</option>
675
+ * </select>
676
+ * ```
677
+ *
678
+ * ```ts
679
+ * const input = screen.getByLabelText('First name')
680
+ * const textarea = screen.getByLabelText('Description')
681
+ * const selectSingle = screen.getByLabelText('Fruit')
682
+ * const selectMultiple = screen.getByLabelText('Fruits')
683
+ *
684
+ * expect(input).toHaveDisplayValue('Luca')
685
+ * expect(textarea).toHaveDisplayValue('An example description here.')
686
+ * expect(selectSingle).toHaveDisplayValue('Select a fruit...')
687
+ * expect(selectMultiple).toHaveDisplayValue(['Banana', 'Avocado'])
688
+ * ```
689
+ *
690
+ * @see
691
+ * [testing-library/jest-dom#tohavedisplayvalue](https://github.com/testing-library/jest-dom#tohavedisplayvalue)
692
+ *
693
+ * @public
694
+ */
695
+ export declare function toHaveDisplayValue(this: MatcherState, htmlElement: Element, expectedValue: string | RegExp | Array<string | RegExp>): IMatcherResult;
696
+
697
+ /**
698
+ * Check whether the given element has an [ARIA error message](https://www.w3.org/TR/wai-aria/#aria-errormessage) or not.
699
+ *
700
+ * Use the `aria-errormessage` attribute to reference another element that contains
701
+ * custom error message text. Multiple ids is **NOT** allowed. Authors MUST use
702
+ * `aria-invalid` in conjunction with `aria-errormessage`. Learn more from the
703
+ * [`aria-errormessage` spec](https://www.w3.org/TR/wai-aria/#aria-errormessage).
704
+ *
705
+ * Whitespace is normalized.
706
+ *
707
+ * When a `string` argument is passed through, it will perform a whole
708
+ * case-sensitive match to the error message text.
709
+ *
710
+ * To perform a case-insensitive match, you can use a `RegExp` with the `/i`
711
+ * modifier.
712
+ *
713
+ * To perform a partial match, you can pass a `RegExp` or use
714
+ * `expect.stringContaining("partial string")`.
715
+ *
716
+ * @example
717
+ * <label for="startTime"> Please enter a start time for the meeting: </label>
718
+ * <input id="startTime" type="text" aria-errormessage="msgID" aria-invalid="true" value="11:30 PM" />
719
+ * <span id="msgID" aria-live="assertive" style="visibility:visible">
720
+ * Invalid time: the time must be between 9:00 AM and 5:00 PM"
721
+ * </span>
722
+ *
723
+ *
724
+ * const timeInput = getByLabel('startTime')
725
+ *
726
+ * expect(timeInput).toHaveErrorMessage(
727
+ * 'Invalid time: the time must be between 9:00 AM and 5:00 PM',
728
+ * )
729
+ * expect(timeInput).toHaveErrorMessage(/invalid time/i) // to partially match
730
+ * expect(timeInput).toHaveErrorMessage(expect.stringContaining('Invalid time')) // to partially match
731
+ * expect(timeInput).not.toHaveErrorMessage('Pikachu!')
732
+ * @see
733
+ * [testing-library/jest-dom#tohaveerrormessage](https://github.com/testing-library/jest-dom#tohaveerrormessage)
734
+ *
735
+ * @public
736
+ */
737
+ export declare function toHaveErrorMessage(this: MatcherState, htmlElement: Element, checkWith?: string | RegExp | typeof expect.stringContaining): IMatcherResult;
738
+
739
+ /**
740
+ * Assert whether an element has focus or not.
741
+ * @example
742
+ * <div>
743
+ * <input type="text" data-testid="element-to-focus" />
744
+ * </div>
745
+ *
746
+ * const input = getByTestId('element-to-focus')
747
+ * input.focus()
748
+ * expect(input).toHaveFocus()
749
+ * input.blur()
750
+ * expect(input).not.toHaveFocus()
751
+ * @see
752
+ * [testing-library/jest-dom#tohavefocus](https://github.com/testing-library/jest-dom#tohavefocus)
753
+ *
754
+ * @public
755
+ */
756
+ export declare function toHaveFocus(this: MatcherState, element: Element): IMatcherResult;
757
+
758
+ /**
759
+ * Check if a form or fieldset contains form controls for each given name, and having the specified value.
760
+ *
761
+ * Can only be invoked on a form or fieldset element.
762
+ *
763
+ * @example
764
+ * ```html
765
+ * <form data-testid="login-form">
766
+ * <input type="text" name="username" value="jane.doe" />
767
+ * <input type="password" name="password" value="123" />
768
+ * <input type="checkbox" name="rememberMe" checked />
769
+ * <button type="submit">Sign in</button>
770
+ * </form>
771
+ * ```
772
+ *
773
+ * ```ts
774
+ * expect(getByTestId('login-form')).toHaveFormValues({
775
+ * username: 'jane.doe',
776
+ * rememberMe: true,
777
+ * })
778
+ * ```
779
+ *
780
+ * @see
781
+ * [testing-library/jest-dom#tohaveformvalues](https://github.com/testing-library/jest-dom#tohaveformvalues)
782
+ *
783
+ * @public
784
+ */
785
+ export declare function toHaveFormValues(this: MatcherState, formElement: Element, expectedValues: Record<string, unknown>): IMatcherResult;
786
+
787
+ /**
788
+ * Check if an element has specific css properties with specific values applied.
789
+ *
790
+ * Only matches if the element has *all* the expected properties applied, not just some of them.
791
+ *
792
+ * @example
793
+ * ```html
794
+ * <button
795
+ * data-test-id="submit-button"
796
+ * style="background-color: green; display: none"
797
+ * >
798
+ * submit
799
+ * </button>
800
+ * ```
801
+ *
802
+ * ```ts
803
+ * const button = getByTestId('submit-button')
804
+ * expect(button).toHaveStyle('background-color: green')
805
+ * expect(button).toHaveStyle({
806
+ * 'background-color': 'green',
807
+ * display: 'none'
808
+ * })
809
+ * ```
810
+ *
811
+ * @see
812
+ * [testing-library/jest-dom#tohavestyle](https://github.com/testing-library/jest-dom#tohavestyle)
813
+ *
814
+ * @public
815
+ */
816
+ export declare function toHaveStyle(this: MatcherState, htmlElement: Element, css: string | Record<string, unknown>): IMatcherResult;
817
+
818
+ /**
819
+ * Check whether the given element has a text content or not.
820
+ *
821
+ * When a string argument is passed through, it will perform a partial case-sensitive match to the element
822
+ * content.
823
+ *
824
+ * To perform a case-insensitive match, you can use a RegExp with the `/i` modifier.
825
+ *
826
+ * If you want to match the whole content, you can use a RegExp to do it.
827
+ * @example
828
+ * <span data-testid="text-content">Text Content</span>
829
+ *
830
+ * const element = getByTestId('text-content')
831
+ * expect(element).toHaveTextContent('Content')
832
+ * // to match the whole content
833
+ * expect(element).toHaveTextContent(/^Text Content$/)
834
+ * // to use case-insentive match
835
+ * expect(element).toHaveTextContent(/content$/i)
836
+ * expect(element).not.toHaveTextContent('content')
837
+ * @see
838
+ * [testing-library/jest-dom#tohavetextcontent](https://github.com/testing-library/jest-dom#tohavetextcontent)
839
+ *
840
+ * @public
841
+ */
842
+ export declare function toHaveTextContent(this: MatcherState, node: Element, checkWith: string | RegExp, options?: {
843
+ normalizeWhitespace: boolean;
844
+ }): IMatcherResult;
845
+
846
+ /**
847
+ * Check whether the given form element has the specified value.
848
+ *
849
+ * Accepts `<input>`, `<select>`, and `<textarea>` elements with the exception of `<input type="checkbox">` and
850
+ * `<input type="radiobox">`, which can be matched only using
851
+ * [toBeChecked](https://github.com/testing-library/jest-dom#tobechecked) or
852
+ * [toHaveFormValues](https://github.com/testing-library/jest-dom#tohaveformvalues).
853
+ * @example
854
+ * <input
855
+ * type="number"
856
+ * value="5"
857
+ * data-testid="input-number" />
858
+ *
859
+ * const numberInput = getByTestId('input-number')
860
+ * expect(numberInput).toHaveValue(5)
861
+ * @see
862
+ * [testing-library/jest-dom#tohavevalue](https://github.com/testing-library/jest-dom#tohavevalue)
863
+ *
864
+ * @public
865
+ */
866
+ export declare function toHaveValue(this: MatcherState, htmlElement: Element, expectedValue?: string | string[] | number | null): IMatcherResult;
867
+
868
+ /**
869
+ * Removes the `string` and `number` index signatures from `T`, keeping only its known keys.
870
+ *
871
+ * @remarks
872
+ * `Matchers` also types `expect.extend()`, so it must not inherit the index
873
+ * signature of `TestingLibraryMatchers` (`Record<string, any>`): that would
874
+ * require every extended matcher to accept arguments of type `unknown`.
875
+ *
876
+ * @public
877
+ */
878
+ export declare type WithoutIndexSignature<T> = {
879
+ [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
880
+ };
881
+
882
+ export { }