@najemi-software/vitest-dom 1.0.1 → 1.1.0-alpha.50.1
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.
- package/CHANGELOG.md +7 -0
- package/esm/index.d.ts +18 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/matchers/to-be-checked.d.ts +8 -1
- package/esm/matchers/to-be-checked.d.ts.map +1 -1
- package/esm/matchers/to-be-checked.js +8 -1
- package/esm/matchers/to-be-checked.js.map +1 -1
- package/esm/matchers/to-be-disabled.d.ts +10 -2
- package/esm/matchers/to-be-disabled.d.ts.map +1 -1
- package/esm/matchers/to-be-disabled.js +10 -2
- package/esm/matchers/to-be-disabled.js.map +1 -1
- package/esm/matchers/to-be-empty-dom-element.d.ts +2 -1
- package/esm/matchers/to-be-empty-dom-element.d.ts.map +1 -1
- package/esm/matchers/to-be-empty-dom-element.js +2 -1
- package/esm/matchers/to-be-empty-dom-element.js.map +1 -1
- package/esm/matchers/to-be-empty.d.ts +5 -2
- package/esm/matchers/to-be-empty.d.ts.map +1 -1
- package/esm/matchers/to-be-empty.js +5 -2
- package/esm/matchers/to-be-empty.js.map +1 -1
- package/esm/matchers/to-be-in-the-document.d.ts +2 -1
- package/esm/matchers/to-be-in-the-document.d.ts.map +1 -1
- package/esm/matchers/to-be-in-the-document.js +2 -1
- package/esm/matchers/to-be-in-the-document.js.map +1 -1
- package/esm/matchers/to-be-in-the-dom.d.ts +6 -3
- package/esm/matchers/to-be-in-the-dom.d.ts.map +1 -1
- package/esm/matchers/to-be-in-the-dom.js +6 -3
- package/esm/matchers/to-be-in-the-dom.js.map +1 -1
- package/esm/matchers/to-be-invalid.d.ts +16 -2
- package/esm/matchers/to-be-invalid.d.ts.map +1 -1
- package/esm/matchers/to-be-invalid.js +16 -2
- package/esm/matchers/to-be-invalid.js.map +1 -1
- package/esm/matchers/to-be-partially-checked.d.ts +7 -1
- package/esm/matchers/to-be-partially-checked.d.ts.map +1 -1
- package/esm/matchers/to-be-partially-checked.js +7 -1
- package/esm/matchers/to-be-partially-checked.js.map +1 -1
- package/esm/matchers/to-be-required.d.ts +8 -1
- package/esm/matchers/to-be-required.d.ts.map +1 -1
- package/esm/matchers/to-be-required.js +8 -1
- package/esm/matchers/to-be-required.js.map +1 -1
- package/esm/matchers/to-be-visible.d.ts +2 -1
- package/esm/matchers/to-be-visible.d.ts.map +1 -1
- package/esm/matchers/to-be-visible.js +2 -1
- package/esm/matchers/to-be-visible.js.map +1 -1
- package/esm/matchers/to-contain-element.d.ts +2 -1
- package/esm/matchers/to-contain-element.d.ts.map +1 -1
- package/esm/matchers/to-contain-element.js +2 -1
- package/esm/matchers/to-contain-element.js.map +1 -1
- package/esm/matchers/to-contain-html.d.ts +2 -1
- package/esm/matchers/to-contain-html.d.ts.map +1 -1
- package/esm/matchers/to-contain-html.js +2 -1
- package/esm/matchers/to-contain-html.js.map +1 -1
- package/esm/matchers/to-have-accessible-description.d.ts +2 -1
- package/esm/matchers/to-have-accessible-description.d.ts.map +1 -1
- package/esm/matchers/to-have-accessible-description.js +2 -1
- package/esm/matchers/to-have-accessible-description.js.map +1 -1
- package/esm/matchers/to-have-accessible-errormessage.d.ts +6 -1
- package/esm/matchers/to-have-accessible-errormessage.d.ts.map +1 -1
- package/esm/matchers/to-have-accessible-errormessage.js +6 -1
- package/esm/matchers/to-have-accessible-errormessage.js.map +1 -1
- package/esm/matchers/to-have-accessible-name.d.ts +2 -1
- package/esm/matchers/to-have-accessible-name.d.ts.map +1 -1
- package/esm/matchers/to-have-accessible-name.js +2 -1
- package/esm/matchers/to-have-accessible-name.js.map +1 -1
- package/esm/matchers/to-have-attribute.d.ts +8 -1
- package/esm/matchers/to-have-attribute.d.ts.map +1 -1
- package/esm/matchers/to-have-attribute.js +8 -1
- package/esm/matchers/to-have-attribute.js.map +1 -1
- package/esm/matchers/to-have-class.d.ts +12 -3
- package/esm/matchers/to-have-class.d.ts.map +1 -1
- package/esm/matchers/to-have-class.js +8 -1
- package/esm/matchers/to-have-class.js.map +1 -1
- package/esm/matchers/to-have-description.d.ts +10 -3
- package/esm/matchers/to-have-description.d.ts.map +1 -1
- package/esm/matchers/to-have-description.js +10 -3
- package/esm/matchers/to-have-description.js.map +1 -1
- package/esm/matchers/to-have-display-value.d.ts +7 -1
- package/esm/matchers/to-have-display-value.d.ts.map +1 -1
- package/esm/matchers/to-have-display-value.js +7 -1
- package/esm/matchers/to-have-display-value.js.map +1 -1
- package/esm/matchers/to-have-errormessage.d.ts +3 -3
- package/esm/matchers/to-have-errormessage.js +3 -3
- package/esm/matchers/to-have-focus.d.ts +2 -1
- package/esm/matchers/to-have-focus.d.ts.map +1 -1
- package/esm/matchers/to-have-focus.js +2 -1
- package/esm/matchers/to-have-focus.js.map +1 -1
- package/esm/matchers/to-have-form-values.d.ts +8 -1
- package/esm/matchers/to-have-form-values.d.ts.map +1 -1
- package/esm/matchers/to-have-form-values.js +8 -1
- package/esm/matchers/to-have-form-values.js.map +1 -1
- package/esm/matchers/to-have-style.d.ts +8 -1
- package/esm/matchers/to-have-style.d.ts.map +1 -1
- package/esm/matchers/to-have-style.js +8 -1
- package/esm/matchers/to-have-style.js.map +1 -1
- package/esm/matchers/to-have-text-content.d.ts +2 -1
- package/esm/matchers/to-have-text-content.d.ts.map +1 -1
- package/esm/matchers/to-have-text-content.js +2 -1
- package/esm/matchers/to-have-text-content.js.map +1 -1
- package/esm/matchers/to-have-value.d.ts +2 -1
- package/esm/matchers/to-have-value.d.ts.map +1 -1
- package/esm/matchers/to-have-value.js +2 -1
- package/esm/matchers/to-have-value.js.map +1 -1
- package/esm/matchers/types.d.ts +15 -0
- package/esm/matchers/types.d.ts.map +1 -1
- package/esm/tsdoc-metadata.json +11 -0
- package/esm/vitest-dom.d.ts +882 -0
- package/package.json +4 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* This allows you to check whether the given element is partially checked.
|
|
5
4
|
* It accepts an input of type checkbox and elements with a role of checkbox
|
|
6
5
|
* with a aria-checked="mixed", or input of type checkbox with indeterminate
|
|
7
6
|
* set to true
|
|
8
7
|
*
|
|
9
8
|
* @example
|
|
9
|
+
* ```html
|
|
10
10
|
* <input type="checkbox" aria-checked="mixed" data-testid="aria-checkbox-mixed" />
|
|
11
11
|
* <input type="checkbox" checked data-testid="input-checkbox-checked" />
|
|
12
12
|
* <input type="checkbox" data-testid="input-checkbox-unchecked" />
|
|
@@ -17,7 +17,9 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
17
17
|
* data-testid="aria-checkbox-unchecked"
|
|
18
18
|
* />
|
|
19
19
|
* <input type="checkbox" data-testid="input-checkbox-indeterminate" />
|
|
20
|
+
* ```
|
|
20
21
|
*
|
|
22
|
+
* ```ts
|
|
21
23
|
* const ariaCheckboxMixed = getByTestId('aria-checkbox-mixed')
|
|
22
24
|
* const inputCheckboxChecked = getByTestId('input-checkbox-checked')
|
|
23
25
|
* const inputCheckboxUnchecked = getByTestId('input-checkbox-unchecked')
|
|
@@ -33,8 +35,12 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
33
35
|
*
|
|
34
36
|
* inputCheckboxIndeterminate.indeterminate = true
|
|
35
37
|
* expect(inputCheckboxIndeterminate).toBePartiallyChecked()
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
36
40
|
* @see
|
|
37
41
|
* [testing-library/jest-dom#tobepartiallychecked](https://github.com/testing-library/jest-dom#tobepartiallychecked)
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
38
44
|
*/
|
|
39
45
|
export declare function toBePartiallyChecked(this: MatcherState, element: Element): IMatcherResult;
|
|
40
46
|
//# sourceMappingURL=to-be-partially-checked.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-partially-checked.d.ts","sourceRoot":"","sources":["../../src/matchers/to-be-partially-checked.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"to-be-partially-checked.d.ts","sourceRoot":"","sources":["../../src/matchers/to-be-partially-checked.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,CAyCzF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { checkHtmlElement } from "./utils.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* This allows you to check whether the given element is partially checked.
|
|
5
4
|
* It accepts an input of type checkbox and elements with a role of checkbox
|
|
6
5
|
* with a aria-checked="mixed", or input of type checkbox with indeterminate
|
|
7
6
|
* set to true
|
|
8
7
|
*
|
|
9
8
|
* @example
|
|
9
|
+
* ```html
|
|
10
10
|
* <input type="checkbox" aria-checked="mixed" data-testid="aria-checkbox-mixed" />
|
|
11
11
|
* <input type="checkbox" checked data-testid="input-checkbox-checked" />
|
|
12
12
|
* <input type="checkbox" data-testid="input-checkbox-unchecked" />
|
|
@@ -17,7 +17,9 @@ import { checkHtmlElement } from "./utils.js";
|
|
|
17
17
|
* data-testid="aria-checkbox-unchecked"
|
|
18
18
|
* />
|
|
19
19
|
* <input type="checkbox" data-testid="input-checkbox-indeterminate" />
|
|
20
|
+
* ```
|
|
20
21
|
*
|
|
22
|
+
* ```ts
|
|
21
23
|
* const ariaCheckboxMixed = getByTestId('aria-checkbox-mixed')
|
|
22
24
|
* const inputCheckboxChecked = getByTestId('input-checkbox-checked')
|
|
23
25
|
* const inputCheckboxUnchecked = getByTestId('input-checkbox-unchecked')
|
|
@@ -33,8 +35,12 @@ import { checkHtmlElement } from "./utils.js";
|
|
|
33
35
|
*
|
|
34
36
|
* inputCheckboxIndeterminate.indeterminate = true
|
|
35
37
|
* expect(inputCheckboxIndeterminate).toBePartiallyChecked()
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
36
40
|
* @see
|
|
37
41
|
* [testing-library/jest-dom#tobepartiallychecked](https://github.com/testing-library/jest-dom#tobepartiallychecked)
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
38
44
|
*/
|
|
39
45
|
export function toBePartiallyChecked(element) {
|
|
40
46
|
checkHtmlElement(element, toBePartiallyChecked, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-partially-checked.js","sourceRoot":"","sources":["../../src/matchers/to-be-partially-checked.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"to-be-partially-checked.js","sourceRoot":"","sources":["../../src/matchers/to-be-partially-checked.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,UAAU,oBAAoB,CAAqB,OAAgB;IACrE,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAC;IAEtD,MAAM,YAAY,GAAG,GAAG,EAAE;QACtB,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,OAAO,IAAK,OAA4B,CAAC,IAAI,KAAK,UAAU,CAAC;IAC1G,CAAC,CAAC;IAEF,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC5B,OAAO,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,UAAU,CAAC;IACvD,CAAC,CAAC;IAEF,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAC3C,OAAO;YACH,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,GAAG,EAAE,CACV,2KAA2K;SAClL,CAAC;IACN,CAAC;IAED,MAAM,kBAAkB,GAAG,GAAG,EAAE;QAC5B,MAAM,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,OAAO,CAAC;QAErE,IAAI,YAAY,EAAE,EAAE,CAAC;YACjB,OAAQ,OAA4B,CAAC,aAAa,IAAI,WAAW,CAAC;QACtE,CAAC;QAED,OAAO,WAAW,CAAC;IACvB,CAAC,CAAC;IAEF,OAAO;QACH,IAAI,EAAE,kBAAkB,EAAE;QAC1B,OAAO,EAAE,GAAG,EAAE;YACV,MAAM,EAAE,GAAG,kBAAkB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC;YAClD,OAAO;gBACH,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,SAAS,EAAE,EAAE,CAAC;gBACzF,EAAE;gBACF,oBAAoB,EAAE,qBAAqB;gBAC3C,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;aAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* This allows you to check if a form element is currently required.
|
|
5
4
|
*
|
|
6
5
|
* An element is required if it is having a `required` or `aria-required="true"` attribute.
|
|
6
|
+
*
|
|
7
7
|
* @example
|
|
8
|
+
* ```html
|
|
8
9
|
* <input data-testid="required-input" required />
|
|
9
10
|
* <div
|
|
10
11
|
* data-testid="supported-role"
|
|
11
12
|
* role="tree"
|
|
12
13
|
* required />
|
|
14
|
+
* ```
|
|
13
15
|
*
|
|
16
|
+
* ```ts
|
|
14
17
|
* expect(getByTestId('required-input')).toBeRequired()
|
|
15
18
|
* expect(getByTestId('supported-role')).not.toBeRequired()
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
16
21
|
* @see
|
|
17
22
|
* [testing-library/jest-dom#toberequired](https://github.com/testing-library/jest-dom#toberequired)
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
18
25
|
*/
|
|
19
26
|
export declare function toBeRequired(this: MatcherState, element: Element): IMatcherResult;
|
|
20
27
|
//# sourceMappingURL=to-be-required.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-required.d.ts","sourceRoot":"","sources":["../../src/matchers/to-be-required.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAoC/D
|
|
1
|
+
{"version":3,"file":"to-be-required.d.ts","sourceRoot":"","sources":["../../src/matchers/to-be-required.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAoC/D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,CAoBjF"}
|
|
@@ -22,21 +22,28 @@ function isElementRequiredByARIA(element) {
|
|
|
22
22
|
SUPPORTED_ARIA_ROLES.includes(element.getAttribute("role") ?? ""))));
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
* @description
|
|
26
25
|
* This allows you to check if a form element is currently required.
|
|
27
26
|
*
|
|
28
27
|
* An element is required if it is having a `required` or `aria-required="true"` attribute.
|
|
28
|
+
*
|
|
29
29
|
* @example
|
|
30
|
+
* ```html
|
|
30
31
|
* <input data-testid="required-input" required />
|
|
31
32
|
* <div
|
|
32
33
|
* data-testid="supported-role"
|
|
33
34
|
* role="tree"
|
|
34
35
|
* required />
|
|
36
|
+
* ```
|
|
35
37
|
*
|
|
38
|
+
* ```ts
|
|
36
39
|
* expect(getByTestId('required-input')).toBeRequired()
|
|
37
40
|
* expect(getByTestId('supported-role')).not.toBeRequired()
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
38
43
|
* @see
|
|
39
44
|
* [testing-library/jest-dom#toberequired](https://github.com/testing-library/jest-dom#toberequired)
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
40
47
|
*/
|
|
41
48
|
export function toBeRequired(element) {
|
|
42
49
|
checkHtmlElement(element, toBeRequired, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-required.js","sourceRoot":"","sources":["../../src/matchers/to-be-required.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEtD,wCAAwC;AACxC,MAAM,SAAS,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAEzC,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;AAEvD,MAAM,uBAAuB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAEzF,MAAM,oBAAoB,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AAE1F,SAAS,+BAA+B,CAAC,OAAgB;IACrD,OAAO,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,0BAA0B,CAAC,OAAgB;IAChD,OAAO,CACH,MAAM,CAAC,OAAO,CAAC,KAAK,OAAO;QAC3B,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC;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IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,SAAS,EAAE,EAAE,CAAC;gBACjF,EAAE;gBACF,oBAAoB,EAAE,YAAY;gBAClC,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;aAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* This allows you to check if an element is currently visible to the user.
|
|
5
4
|
*
|
|
6
5
|
* An element is visible if **all** the following conditions are met:
|
|
@@ -24,6 +23,8 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
24
23
|
* expect(getByTestId('visible')).toBeVisible()
|
|
25
24
|
* @see
|
|
26
25
|
* [testing-library/jest-dom#tobevisible](https://github.com/testing-library/jest-dom#tobevisible)
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
27
28
|
*/
|
|
28
29
|
export declare function toBeVisible(this: MatcherState, element: Element): IMatcherResult;
|
|
29
30
|
//# sourceMappingURL=to-be-visible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-visible.d.ts","sourceRoot":"","sources":["../../src/matchers/to-be-visible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiC/D
|
|
1
|
+
{"version":3,"file":"to-be-visible.d.ts","sourceRoot":"","sources":["../../src/matchers/to-be-visible.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiC/D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAG,cAAc,CAgBhF"}
|
|
@@ -23,7 +23,6 @@ function isElementVisible(element, previousElement) {
|
|
|
23
23
|
(!element.parentElement || isElementVisible(element.parentElement, element)));
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* @description
|
|
27
26
|
* This allows you to check if an element is currently visible to the user.
|
|
28
27
|
*
|
|
29
28
|
* An element is visible if **all** the following conditions are met:
|
|
@@ -47,6 +46,8 @@ function isElementVisible(element, previousElement) {
|
|
|
47
46
|
* expect(getByTestId('visible')).toBeVisible()
|
|
48
47
|
* @see
|
|
49
48
|
* [testing-library/jest-dom#tobevisible](https://github.com/testing-library/jest-dom#tobevisible)
|
|
49
|
+
*
|
|
50
|
+
* @public
|
|
50
51
|
*/
|
|
51
52
|
export function toBeVisible(element) {
|
|
52
53
|
checkHtmlElement(element, toBeVisible, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-be-visible.js","sourceRoot":"","sources":["../../src/matchers/to-be-visible.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,SAAS,cAAc,CAAC,OAAgB;IACpC,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,WAAY,CAAC;IAEhE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACnE,OAAO,OAAO,KAAK,MAAM,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,UAAU,IAAI,OAAO,KAAK,GAAG,CAAC;AACzG,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAgB,EAAE,eAAyB;IACnE,IAAI,iBAA0B,CAAC;IAE/B,IAAI,eAAe,EAAE,CAAC;QAClB,iBAAiB;YACb,OAAO,CAAC,QAA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AAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,CAAC;gBAChF,EAAE;gBACF,oBAAoB,EAAE,WAAW,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mCAAmC,GAAG;gBAC3F,KAAK,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE;aAC5D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* Allows you to assert whether an element contains another element as a descendant or not.
|
|
5
4
|
* @example
|
|
6
5
|
* <span data-testid="ancestor">
|
|
@@ -15,6 +14,8 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
15
14
|
* expect(ancestor).not.toContainElement(nonExistantElement)
|
|
16
15
|
* @see
|
|
17
16
|
* [testing-library/jest-dom#tocontainelement](https://github.com/testing-library/jest-dom#tocontainelement)
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
18
19
|
*/
|
|
19
20
|
export declare function toContainElement(this: MatcherState, container: Element, element: HTMLElement | SVGElement | null): IMatcherResult;
|
|
20
21
|
//# sourceMappingURL=to-contain-element.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-contain-element.d.ts","sourceRoot":"","sources":["../../src/matchers/to-contain-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"to-contain-element.d.ts","sourceRoot":"","sources":["../../src/matchers/to-contain-element.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,YAAY,EAClB,SAAS,EAAE,OAAO,EAClB,OAAO,EAAE,WAAW,GAAG,UAAU,GAAG,IAAI,GACzC,cAAc,CAoBhB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { checkHtmlElement } from "./utils.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* Allows you to assert whether an element contains another element as a descendant or not.
|
|
5
4
|
* @example
|
|
6
5
|
* <span data-testid="ancestor">
|
|
@@ -15,6 +14,8 @@ import { checkHtmlElement } from "./utils.js";
|
|
|
15
14
|
* expect(ancestor).not.toContainElement(nonExistantElement)
|
|
16
15
|
* @see
|
|
17
16
|
* [testing-library/jest-dom#tocontainelement](https://github.com/testing-library/jest-dom#tocontainelement)
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
18
19
|
*/
|
|
19
20
|
export function toContainElement(container, element) {
|
|
20
21
|
checkHtmlElement(container, toContainElement, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-contain-element.js","sourceRoot":"","sources":["../../src/matchers/to-contain-element.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"to-contain-element.js","sourceRoot":"","sources":["../../src/matchers/to-contain-element.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,gBAAgB,CAE5B,SAAkB,EAClB,OAAwC;IAExC,gBAAgB,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;IAEpD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACnB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,OAAO;QACH,IAAI,EAAE,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC;QACjC,OAAO,EAAE,GAAG,EAAE;YACV,OAAO;gBACH,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,CAAC;gBAC5F,EAAE;gBACF,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IACzE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,mBAC/B,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;SAC7E,CAAC;aACG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* Assert whether a string representing a HTML element is contained in another element.
|
|
5
4
|
* @example
|
|
6
5
|
* <span data-testid="parent"><span data-testid="child"></span></span>
|
|
@@ -8,6 +7,8 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
8
7
|
* expect(getByTestId('parent')).toContainHTML('<span data-testid="child"></span>')
|
|
9
8
|
* @see
|
|
10
9
|
* [testing-library/jest-dom#tocontainhtml](https://github.com/testing-library/jest-dom#tocontainhtml)
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
11
12
|
*/
|
|
12
13
|
export declare function toContainHTML(this: MatcherState, container: Element, htmlText: string): IMatcherResult;
|
|
13
14
|
//# sourceMappingURL=to-contain-html.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-contain-html.d.ts","sourceRoot":"","sources":["../../src/matchers/to-contain-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/D
|
|
1
|
+
{"version":3,"file":"to-contain-html.d.ts","sourceRoot":"","sources":["../../src/matchers/to-contain-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAS/D;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,cAAc,CAmBtG"}
|
|
@@ -5,7 +5,6 @@ function getNormalizedHtml(container, htmlText) {
|
|
|
5
5
|
return div.innerHTML;
|
|
6
6
|
}
|
|
7
7
|
/**
|
|
8
|
-
* @description
|
|
9
8
|
* Assert whether a string representing a HTML element is contained in another element.
|
|
10
9
|
* @example
|
|
11
10
|
* <span data-testid="parent"><span data-testid="child"></span></span>
|
|
@@ -13,6 +12,8 @@ function getNormalizedHtml(container, htmlText) {
|
|
|
13
12
|
* expect(getByTestId('parent')).toContainHTML('<span data-testid="child"></span>')
|
|
14
13
|
* @see
|
|
15
14
|
* [testing-library/jest-dom#tocontainhtml](https://github.com/testing-library/jest-dom#tocontainhtml)
|
|
15
|
+
*
|
|
16
|
+
* @public
|
|
16
17
|
*/
|
|
17
18
|
export function toContainHTML(container, htmlText) {
|
|
18
19
|
checkHtmlElement(container, toContainHTML, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-contain-html.js","sourceRoot":"","sources":["../../src/matchers/to-contain-html.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C,SAAS,iBAAiB,CAAC,SAAkB,EAAE,QAAgB;IAC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,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE;aAC7D,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { expect } from "vitest";
|
|
2
2
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
5
4
|
* This allows to assert that an element has the expected [accessible description](https://w3c.github.io/accname/).
|
|
6
5
|
*
|
|
7
6
|
* You can pass the exact string of the expected accessible description, or you can make a
|
|
@@ -24,6 +23,8 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
24
23
|
* expect(getByTestId('logo')).toHaveAccessibleDescription('The logo of Our Company')
|
|
25
24
|
* @see
|
|
26
25
|
* [testing-library/jest-dom#tohaveaccessibledescription](https://github.com/testing-library/jest-dom#tohaveaccessibledescription)
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
27
28
|
*/
|
|
28
29
|
export declare function toHaveAccessibleDescription(this: MatcherState, htmlElement: Element, expectedAccessibleDescription?: string | RegExp | typeof expect.stringContaining): IMatcherResult;
|
|
29
30
|
//# sourceMappingURL=to-have-accessible-description.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessible-description.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-description.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"to-have-accessible-description.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-description.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,2BAA2B,CACvC,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,OAAO,EACpB,6BAA6B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,MAAM,CAAC,gBAAgB,GACjF,cAAc,CAoChB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { computeAccessibleDescription } from "dom-accessibility-api";
|
|
2
2
|
import { checkHtmlElement, getMessage } from "./utils.js";
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
5
4
|
* This allows to assert that an element has the expected [accessible description](https://w3c.github.io/accname/).
|
|
6
5
|
*
|
|
7
6
|
* You can pass the exact string of the expected accessible description, or you can make a
|
|
@@ -24,6 +23,8 @@ import { checkHtmlElement, getMessage } from "./utils.js";
|
|
|
24
23
|
* expect(getByTestId('logo')).toHaveAccessibleDescription('The logo of Our Company')
|
|
25
24
|
* @see
|
|
26
25
|
* [testing-library/jest-dom#tohaveaccessibledescription](https://github.com/testing-library/jest-dom#tohaveaccessibledescription)
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
27
28
|
*/
|
|
28
29
|
export function toHaveAccessibleDescription(htmlElement, expectedAccessibleDescription) {
|
|
29
30
|
checkHtmlElement(htmlElement, toHaveAccessibleDescription, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessible-description.js","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAIrE,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"to-have-accessible-description.js","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-description.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,uBAAuB,CAAC;AAIrE,OAAO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
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* This allows you to assert that an element has the expected
|
|
5
4
|
* [accessible error message](https://w3c.github.io/aria/#aria-errormessage).
|
|
6
5
|
*
|
|
@@ -11,12 +10,15 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
11
10
|
* or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
|
|
12
11
|
*
|
|
13
12
|
* @example
|
|
13
|
+
* ```html
|
|
14
14
|
* <input aria-label="Has Error" aria-invalid="true" aria-errormessage="error-message" />
|
|
15
15
|
* <div id="error-message" role="alert">This field is invalid</div>
|
|
16
16
|
*
|
|
17
17
|
* <input aria-label="No Error Attributes" />
|
|
18
18
|
* <input aria-label="Not Invalid" aria-invalid="false" aria-errormessage="error-message" />
|
|
19
|
+
* ```
|
|
19
20
|
*
|
|
21
|
+
* ```ts
|
|
20
22
|
* // Inputs with Valid Error Messages
|
|
21
23
|
* expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage()
|
|
22
24
|
* expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage('This field is invalid')
|
|
@@ -33,9 +35,12 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
33
35
|
* expect(
|
|
34
36
|
* getByRole('textbox', {name: 'Not Invalid'}),
|
|
35
37
|
* ).not.toHaveAccessibleErrorMessage()
|
|
38
|
+
* ```
|
|
36
39
|
*
|
|
37
40
|
* @see
|
|
38
41
|
* [testing-library/jest-dom#tohaveaccessibleerrormessage](https://github.com/testing-library/jest-dom#tohaveaccessibleerrormessage)
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
39
44
|
*/
|
|
40
45
|
export declare function toHaveAccessibleErrorMessage<State extends MatcherState>(this: State, htmlElement: Element, expectedAccessibleErrorMessage?: string | RegExp | State): IMatcherResult;
|
|
41
46
|
//# sourceMappingURL=to-have-accessible-errormessage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessible-errormessage.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-errormessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO/D
|
|
1
|
+
{"version":3,"file":"to-have-accessible-errormessage.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-errormessage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAO/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,SAAS,YAAY,EACnE,IAAI,EAAE,KAAK,EACX,WAAW,EAAE,OAAO,EACpB,8BAA8B,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GACzD,cAAc,CAyEhB"}
|
|
@@ -3,7 +3,6 @@ const ariaInvalidName = "aria-invalid";
|
|
|
3
3
|
const validStates = ["false"];
|
|
4
4
|
// See `aria-errormessage` spec at https://www.w3.org/TR/wai-aria-1.2/#aria-errormessage
|
|
5
5
|
/**
|
|
6
|
-
* @description
|
|
7
6
|
* This allows you to assert that an element has the expected
|
|
8
7
|
* [accessible error message](https://w3c.github.io/aria/#aria-errormessage).
|
|
9
8
|
*
|
|
@@ -14,12 +13,15 @@ const validStates = ["false"];
|
|
|
14
13
|
* or [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
|
|
15
14
|
*
|
|
16
15
|
* @example
|
|
16
|
+
* ```html
|
|
17
17
|
* <input aria-label="Has Error" aria-invalid="true" aria-errormessage="error-message" />
|
|
18
18
|
* <div id="error-message" role="alert">This field is invalid</div>
|
|
19
19
|
*
|
|
20
20
|
* <input aria-label="No Error Attributes" />
|
|
21
21
|
* <input aria-label="Not Invalid" aria-invalid="false" aria-errormessage="error-message" />
|
|
22
|
+
* ```
|
|
22
23
|
*
|
|
24
|
+
* ```ts
|
|
23
25
|
* // Inputs with Valid Error Messages
|
|
24
26
|
* expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage()
|
|
25
27
|
* expect(getByRole('textbox', {name: 'Has Error'})).toHaveAccessibleErrorMessage('This field is invalid')
|
|
@@ -36,9 +38,12 @@ const validStates = ["false"];
|
|
|
36
38
|
* expect(
|
|
37
39
|
* getByRole('textbox', {name: 'Not Invalid'}),
|
|
38
40
|
* ).not.toHaveAccessibleErrorMessage()
|
|
41
|
+
* ```
|
|
39
42
|
*
|
|
40
43
|
* @see
|
|
41
44
|
* [testing-library/jest-dom#tohaveaccessibleerrormessage](https://github.com/testing-library/jest-dom#tohaveaccessibleerrormessage)
|
|
45
|
+
*
|
|
46
|
+
* @public
|
|
42
47
|
*/
|
|
43
48
|
export function toHaveAccessibleErrorMessage(htmlElement, expectedAccessibleErrorMessage) {
|
|
44
49
|
checkHtmlElement(htmlElement, toHaveAccessibleErrorMessage, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessible-errormessage.js","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-errormessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,CAAC;AAE9B,wFAAwF;AACxF
|
|
1
|
+
{"version":3,"file":"to-have-accessible-errormessage.js","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-errormessage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAErE,MAAM,eAAe,GAAG,cAAc,CAAC;AACvC,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,CAAC;AAE9B,wFAAwF;AACxF;;;;;;;;;;;;;;;;;;;;;;;;;;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D,EACzD,GAAG,eAAe,KAAK,MAAM,CAAC,IAAI,CAAC,GAAG,EACtC,UAAU,EACV,WAAW,CAAC,YAAY,CAAC,cAAc,CAAC;oBACpC,CAAC,CAAC,GAAG,eAAe,KAAK,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,EAAE;oBACpE,CAAC,CAAC,IAAI,CACb,CAAC;YACN,CAAC;SACJ,CAAC;IACN,CAAC;IAED,MAAM,KAAK,GAAG,SAAS,CACnB,cAAc,IAAI,IAAI;QAClB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,CAAC,WAAW,CAAC,aAAa,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW,IAAI,EAAE,CAAC,CACtF,CAAC;IAEF,OAAO;QACH,IAAI,EACA,8BAA8B,KAAK,SAAS;YACxC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;YAChB,CAAC,CAAC,8BAA8B,YAAY,MAAM;gBAChD,CAAC,CAAC,8BAA8B,CAAC,IAAI,CAAC,KAAK,CAAC;gBAC5C,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,8BAA8B,CAAC;QAE9D,OAAO,EAAE,GAAG,EAAE;YACV,OAAO,UAAU,CACb,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,EACzC,oBAAoB,EAAE,gCAAgC,EACtD,8BAA8B,IAAI,EAAE,EACpC,UAAU,EACV,KAAK,CACR,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { expect } from "vitest";
|
|
2
2
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
5
4
|
* This allows to assert that an element has the expected [accessible name](https://w3c.github.io/accname/).
|
|
6
5
|
* It is useful, for instance, to assert that form elements and buttons are properly labelled.
|
|
7
6
|
*
|
|
@@ -29,6 +28,8 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
29
28
|
* expect(getByTestId('input-title')).toHaveAccessibleName()
|
|
30
29
|
* @see
|
|
31
30
|
* [testing-library/jest-dom#tohaveaccessiblename](https://github.com/testing-library/jest-dom#tohaveaccessiblename)
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
32
33
|
*/
|
|
33
34
|
export declare function toHaveAccessibleName(this: MatcherState, htmlElement: Element, expectedAccessibleName?: string | RegExp | typeof expect.stringContaining): IMatcherResult;
|
|
34
35
|
//# sourceMappingURL=to-have-accessible-name.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessible-name.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D
|
|
1
|
+
{"version":3,"file":"to-have-accessible-name.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-name.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,OAAO,EACpB,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,MAAM,CAAC,gBAAgB,GAC1E,cAAc,CAoChB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { computeAccessibleName } from "dom-accessibility-api";
|
|
2
2
|
import { checkHtmlElement, getMessage } from "./utils.js";
|
|
3
3
|
/**
|
|
4
|
-
* @description
|
|
5
4
|
* This allows to assert that an element has the expected [accessible name](https://w3c.github.io/accname/).
|
|
6
5
|
* It is useful, for instance, to assert that form elements and buttons are properly labelled.
|
|
7
6
|
*
|
|
@@ -29,6 +28,8 @@ import { checkHtmlElement, getMessage } from "./utils.js";
|
|
|
29
28
|
* expect(getByTestId('input-title')).toHaveAccessibleName()
|
|
30
29
|
* @see
|
|
31
30
|
* [testing-library/jest-dom#tohaveaccessiblename](https://github.com/testing-library/jest-dom#tohaveaccessiblename)
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
32
33
|
*/
|
|
33
34
|
export function toHaveAccessibleName(htmlElement, expectedAccessibleName) {
|
|
34
35
|
checkHtmlElement(htmlElement, toHaveAccessibleName, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-accessible-name.js","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"to-have-accessible-name.js","sourceRoot":"","sources":["../../src/matchers/to-have-accessible-name.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,oBAAoB,CAEhC,WAAoB,EACpB,sBAAyE;IAEzE,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,EAAE,IAAI,CAAC,CAAC;IAC1D,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAChE,MAAM,oBAAoB,GAAG,SAAS,CAAC,MAAM,KAAK,CAAC,CAAC;IAEpD,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,oBAAoB,EAAE,CAAC;QACvB,yFAAyF;QACzF,uCAAuC;QACvC,IAAI,GAAG,oBAAoB,KAAK,EAAE,CAAC;IACvC,CAAC;SAAM,CAAC;QACJ,IAAI;YACA,sBAAsB,YAAY,MAAM;gBACpC,CAAC,CAAC,sBAAsB,CAAC,IAAI,CAAC,oBAAoB,CAAC;gBACnD,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IACxE,CAAC;IAED,OAAO;QACH,IAAI;QAEJ,OAAO,EAAE,GAAG,EAAE;YACV,MAAM,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC;YACxC,OAAO,UAAU,CACb,IAAI,EACJ,IAAI,CAAC,KAAK,CAAC,WAAW,CAClB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,oBAAoB,CAAC,IAAI,EAAE,EAC1D,SAAS,EACT,EAAE,CACL,EACD,oBAAoB,EAAE,uBAAuB,EAC7C,sBAAsB,EACtB,UAAU,EACV,oBAAoB,CACvB,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { IMatcherResult, MatcherState } from "./types.js";
|
|
2
2
|
/**
|
|
3
|
-
* @description
|
|
4
3
|
* Allows you to check if a given element has an attribute or not.
|
|
5
4
|
*
|
|
6
5
|
* You can also optionally check that the attribute has a specific expected value or partial match using
|
|
7
6
|
* [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) or
|
|
8
7
|
* [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
|
|
8
|
+
*
|
|
9
9
|
* @example
|
|
10
|
+
* ```html
|
|
10
11
|
* <button
|
|
11
12
|
* data-testid="ok-button"
|
|
12
13
|
* type="submit"
|
|
@@ -14,12 +15,18 @@ import type { IMatcherResult, MatcherState } from "./types.js";
|
|
|
14
15
|
* >
|
|
15
16
|
* ok
|
|
16
17
|
* </button>
|
|
18
|
+
* ```
|
|
17
19
|
*
|
|
20
|
+
* ```ts
|
|
18
21
|
* expect(button).toHaveAttribute('disabled')
|
|
19
22
|
* expect(button).toHaveAttribute('type', 'submit')
|
|
20
23
|
* expect(button).not.toHaveAttribute('type', 'button')
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
21
26
|
* @see
|
|
22
27
|
* [testing-library/jest-dom#tohaveattribute](https://github.com/testing-library/jest-dom#tohaveattribute)
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
23
30
|
*/
|
|
24
31
|
export declare function toHaveAttribute(this: MatcherState, htmlElement: Element, name: string, expectedValue?: unknown): IMatcherResult;
|
|
25
32
|
//# sourceMappingURL=to-have-attribute.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-attribute.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-attribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAa/D
|
|
1
|
+
{"version":3,"file":"to-have-attribute.d.ts","sourceRoot":"","sources":["../../src/matchers/to-have-attribute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAa/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAC3B,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,OAAO,EACpB,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,OAAO,GACxB,cAAc,CAmChB"}
|
|
@@ -8,13 +8,14 @@ function getAttributeComment(stringify, name, value) {
|
|
|
8
8
|
: `element.getAttribute(${stringify(name)}) === ${stringify(value)}`;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* @description
|
|
12
11
|
* Allows you to check if a given element has an attribute or not.
|
|
13
12
|
*
|
|
14
13
|
* You can also optionally check that the attribute has a specific expected value or partial match using
|
|
15
14
|
* [expect.stringContaining](https://jestjs.io/docs/en/expect.html#expectnotstringcontainingstring) or
|
|
16
15
|
* [expect.stringMatching](https://jestjs.io/docs/en/expect.html#expectstringmatchingstring-regexp).
|
|
16
|
+
*
|
|
17
17
|
* @example
|
|
18
|
+
* ```html
|
|
18
19
|
* <button
|
|
19
20
|
* data-testid="ok-button"
|
|
20
21
|
* type="submit"
|
|
@@ -22,12 +23,18 @@ function getAttributeComment(stringify, name, value) {
|
|
|
22
23
|
* >
|
|
23
24
|
* ok
|
|
24
25
|
* </button>
|
|
26
|
+
* ```
|
|
25
27
|
*
|
|
28
|
+
* ```ts
|
|
26
29
|
* expect(button).toHaveAttribute('disabled')
|
|
27
30
|
* expect(button).toHaveAttribute('type', 'submit')
|
|
28
31
|
* expect(button).not.toHaveAttribute('type', 'button')
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
29
34
|
* @see
|
|
30
35
|
* [testing-library/jest-dom#tohaveattribute](https://github.com/testing-library/jest-dom#tohaveattribute)
|
|
36
|
+
*
|
|
37
|
+
* @public
|
|
31
38
|
*/
|
|
32
39
|
export function toHaveAttribute(htmlElement, name, expectedValue) {
|
|
33
40
|
checkHtmlElement(htmlElement, toHaveAttribute, this);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-have-attribute.js","sourceRoot":"","sources":["../../src/matchers/to-have-attribute.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE1D,SAAS,cAAc,CAAC,SAAqC,EAAE,IAAY,EAAE,KAAc;IACvF,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;AACtE,CAAC;AAED,SAAS,mBAAmB,CAAC,SAAqC,EAAE,IAAY,EAAE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