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