@sa11y/jest 6.9.5-alpha.3 → 6.9.5-alpha.4
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/dist/automatic.d.ts.map +1 -1
- package/dist/automatic.js +21 -12
- package/package.json +7 -7
package/dist/automatic.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automatic.d.ts","sourceRoot":"","sources":["../src/automatic.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAgBF,eAAO,MAAM,2BAA2B,aAAc,MAAM,GAAG,IAAI,SAElE,CAAC;AAEF,eAAO,MAAM,2BAA2B,qBAEvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAUtF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE,aAAoC,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"automatic.d.ts","sourceRoot":"","sources":["../src/automatic.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC,CAAC;AAgBF,eAAO,MAAM,2BAA2B,aAAc,MAAM,GAAG,IAAI,SAElE,CAAC;AAEF,eAAO,MAAM,2BAA2B,qBAEvC,CAAC;AAEF;;GAEG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAUtF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,IAAI,GAAE,aAAoC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwF9F;AAsBD;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,GAAE,aAAoC,GAAG,IAAI,CAmB7F"}
|
package/dist/automatic.js
CHANGED
|
@@ -86,19 +86,25 @@ async function automaticCheck(opts = defaultAutoCheckOpts) {
|
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
88
88
|
customRules = [];
|
|
89
|
+
if (customRules.length === 0)
|
|
90
|
+
violations.push(...(await (0, assert_1.getViolationsJSDOM)(document.body, (0, setup_1.adaptA11yConfig)(preset_rules_1.defaultRuleset))));
|
|
91
|
+
else
|
|
92
|
+
violations.push(...(await (0, assert_1.getViolationsJSDOM)(document.body, (0, setup_1.adaptA11yConfigCustomRules)(preset_rules_1.defaultRuleset, customRules))));
|
|
93
|
+
document.body.innerHTML = '';
|
|
89
94
|
// loop mutated nodes
|
|
90
|
-
for (
|
|
91
|
-
if (
|
|
92
|
-
document.body.innerHTML =
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
for await (const mutatedNode of mutatedNodes) {
|
|
96
|
+
if (mutatedNode) {
|
|
97
|
+
document.body.innerHTML = mutatedNode;
|
|
98
|
+
// remove walker
|
|
99
|
+
// const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);
|
|
100
|
+
// let currNode = walker.firstChild();
|
|
101
|
+
// while (currNode !== null) {
|
|
102
|
+
if (customRules.length === 0)
|
|
103
|
+
violations.push(...(await (0, assert_1.getViolationsJSDOM)(document.body, (0, setup_1.adaptA11yConfig)(preset_rules_1.defaultRuleset))));
|
|
104
|
+
else
|
|
105
|
+
violations.push(...(await (0, assert_1.getViolationsJSDOM)(document.body, (0, setup_1.adaptA11yConfigCustomRules)(preset_rules_1.defaultRuleset, customRules))));
|
|
106
|
+
// currNode = walker.nextSibling();
|
|
107
|
+
// }
|
|
102
108
|
}
|
|
103
109
|
}
|
|
104
110
|
}
|
|
@@ -127,6 +133,9 @@ function observerCallback(mutations, _observer) {
|
|
|
127
133
|
if (node?.parentElement?.innerHTML) {
|
|
128
134
|
mutatedNodes.push(node.parentElement.innerHTML);
|
|
129
135
|
}
|
|
136
|
+
else if (node?.outerHTML) {
|
|
137
|
+
mutatedNodes.push(node?.outerHTML);
|
|
138
|
+
}
|
|
130
139
|
});
|
|
131
140
|
}
|
|
132
141
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sa11y/jest",
|
|
3
|
-
"version": "6.9.5-alpha.
|
|
3
|
+
"version": "6.9.5-alpha.4",
|
|
4
4
|
"description": "Accessibility testing matcher for Jest",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"homepage": "https://github.com/salesforce/sa11y/tree/master/packages/jest#readme",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@jest/test-result": "^27",
|
|
27
|
-
"@sa11y/assert": "6.9.5-alpha.
|
|
28
|
-
"@sa11y/format": "6.9.5-alpha.
|
|
29
|
-
"@sa11y/preset-rules": "6.9.5-alpha.
|
|
27
|
+
"@sa11y/assert": "6.9.5-alpha.4",
|
|
28
|
+
"@sa11y/format": "6.9.5-alpha.4",
|
|
29
|
+
"@sa11y/preset-rules": "6.9.5-alpha.4",
|
|
30
30
|
"jest-matcher-utils": "^27"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@jest/globals": "28.1.3",
|
|
37
|
-
"@sa11y/common": "6.9.5-alpha.
|
|
38
|
-
"@sa11y/test-utils": "6.9.5-alpha.
|
|
37
|
+
"@sa11y/common": "6.9.5-alpha.4",
|
|
38
|
+
"@sa11y/test-utils": "6.9.5-alpha.4"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": "^16 || ^18 || ^20"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "f76314d90c55041be24e945d6cd424f59a38c368"
|
|
47
47
|
}
|