@sa11y/jest 6.9.5-alpha.2 → 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 +23 -13
- 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
|
@@ -66,7 +66,7 @@ async function automaticCheck(opts = defaultAutoCheckOpts) {
|
|
|
66
66
|
// Create a DOM walker filtering only elements (skipping text, comment nodes etc)
|
|
67
67
|
const walker = document.createTreeWalker(document.body, NodeFilter.SHOW_ELEMENT);
|
|
68
68
|
let currNode = walker.firstChild();
|
|
69
|
-
|
|
69
|
+
let customRules = (0, common_1.useCustomRules)();
|
|
70
70
|
try {
|
|
71
71
|
if (!opts.runDOMMutationObserver) {
|
|
72
72
|
while (currNode !== null) {
|
|
@@ -85,19 +85,26 @@ async function automaticCheck(opts = defaultAutoCheckOpts) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
else {
|
|
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 = '';
|
|
88
94
|
// loop mutated nodes
|
|
89
|
-
for (
|
|
90
|
-
if (
|
|
91
|
-
document.body.innerHTML =
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
// }
|
|
101
108
|
}
|
|
102
109
|
}
|
|
103
110
|
}
|
|
@@ -126,6 +133,9 @@ function observerCallback(mutations, _observer) {
|
|
|
126
133
|
if (node?.parentElement?.innerHTML) {
|
|
127
134
|
mutatedNodes.push(node.parentElement.innerHTML);
|
|
128
135
|
}
|
|
136
|
+
else if (node?.outerHTML) {
|
|
137
|
+
mutatedNodes.push(node?.outerHTML);
|
|
138
|
+
}
|
|
129
139
|
});
|
|
130
140
|
}
|
|
131
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
|
}
|