testaro 60.15.1 → 60.16.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/package.json +1 -1
- package/testaro/secHeading.js +1 -1
- package/testaro/targetSmall.js +5 -5
- package/testaro/textSem.js +25 -14
- package/testaro/zIndex.js +20 -27
- package/validation/tests/jobProperties/targetSmall.json +1 -1
- package/validation/tests/jobProperties/targetTiny.json +1 -1
- package/validation/tests/targets/{targetSize → targetSmall}/index.html +12 -7
package/package.json
CHANGED
package/testaro/secHeading.js
CHANGED
|
@@ -46,7 +46,7 @@ exports.reporter = async (page, withItems) => {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
const selector = '
|
|
49
|
+
const selector = 'section, article, nav, aside, main';
|
|
50
50
|
const whats = 'First child headings of sectioning containers are deeper than others';
|
|
51
51
|
return await doTest(
|
|
52
52
|
page, withItems, 'secHeading', selector, whats, 0, null, getBadWhat.toString()
|
package/testaro/targetSmall.js
CHANGED
|
@@ -48,15 +48,15 @@ exports.reporter = async (page, withItems) => {
|
|
|
48
48
|
const instances = [];
|
|
49
49
|
// For each visible pointer target:
|
|
50
50
|
visiblePTs.forEach((element, index) => {
|
|
51
|
+
const [centerX, centerY] = ptsData[index];
|
|
52
|
+
const otherPTsData = ptsData.toSpliced(index, 1);
|
|
51
53
|
// Get the minimum of the vertical distances of its centerpoint from those of the others.
|
|
52
|
-
const minYDiff =
|
|
53
|
-
Math.min(...ptsData.splice(index, 1).map(ptData => ptData[1]))
|
|
54
|
-
);
|
|
54
|
+
const minYDiff = Math.min(...otherPTsData.map(ptData => Math.abs(centerY - ptData[1])));
|
|
55
55
|
// If it is close enough to make a violation possible:
|
|
56
56
|
if (minYDiff < 44) {
|
|
57
57
|
// Get the centerpoint coordinates of those within that vertical distance.
|
|
58
|
-
const yNearPTsData =
|
|
59
|
-
ptData => Math.abs(ptData[1] -
|
|
58
|
+
const yNearPTsData = otherPTsData.filter(
|
|
59
|
+
ptData => Math.abs(ptData[1] - centerY) < 44
|
|
60
60
|
);
|
|
61
61
|
// Get the minimum of their planar distances.
|
|
62
62
|
const minPlanarDistance = Math.min(...yNearPTsData.map(ptData => {
|
package/testaro/textSem.js
CHANGED
|
@@ -13,21 +13,32 @@
|
|
|
13
13
|
Report semantically vague inline elements: i, b, small
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
// IMPORTS
|
|
17
17
|
|
|
18
|
+
const {doTest} = require('../procs/testaro');
|
|
19
|
+
|
|
20
|
+
// FUNCTIONS
|
|
21
|
+
|
|
22
|
+
// Runs the test and returns the result.
|
|
18
23
|
exports.reporter = async (page, withItems) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return !!text;
|
|
24
|
+
const getBadWhat = element => {
|
|
25
|
+
const isVisible = element.checkVisibility({
|
|
26
|
+
contentVisibilityAuto: true,
|
|
27
|
+
opacityProperty: true,
|
|
28
|
+
visibilityProperty: true
|
|
25
29
|
});
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
// If the element is visible:
|
|
31
|
+
if (isVisible) {
|
|
32
|
+
// If it has text content:
|
|
33
|
+
if (element.textContent.trim().replace(/\s/g, '')) {
|
|
34
|
+
// Return a violation description.
|
|
35
|
+
return `Element type (${element.tagName}) is semantically vague`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const selector = 'i, b, small';
|
|
40
|
+
const whats = 'Semantically vague elements i, b, and/or small are used';
|
|
41
|
+
return await doTest(
|
|
42
|
+
page, withItems, 'textSem', selector, whats, 0, null, getBadWhat.toString()
|
|
43
|
+
);
|
|
33
44
|
};
|
package/testaro/zIndex.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
© 2021–2023 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
|
+
© 2025 Jonathan Robert Pool
|
|
3
4
|
|
|
4
5
|
Licensed under the MIT License. See LICENSE file at the project root or
|
|
5
6
|
https://opensource.org/license/mit/ for details.
|
|
@@ -9,42 +10,34 @@
|
|
|
9
10
|
|
|
10
11
|
/*
|
|
11
12
|
zIndex
|
|
12
|
-
This test reports elements with
|
|
13
|
+
This test reports elements with abnormal Z indexes. It assumes that pages are most accessible
|
|
13
14
|
when they do not require users to perceive a third dimension (depth). Layers, popups, and dialogs
|
|
14
15
|
that cover other content make it difficult for some or all users to interpret the content and
|
|
15
|
-
know what parts of the content can be acted on. Layering also complicates accessibility
|
|
16
|
+
know what parts of the content can be acted on. Layering also complicates accessibility testing.
|
|
16
17
|
Tests for visibility of focus, for example, may fail if incapable of detecting that a focused
|
|
17
|
-
element is covered by another element.
|
|
18
|
+
element is covered by another element. Z indexes other than auto and 0 are considered abnormal.
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
|
-
//
|
|
21
|
+
// IMPORTS
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
const {init, getRuleResult} = require('../procs/testaro');
|
|
23
|
+
const {doTest} = require('../procs/testaro');
|
|
24
24
|
|
|
25
|
-
//
|
|
25
|
+
// FUNCTIONS
|
|
26
26
|
|
|
27
27
|
// Runs the test and returns the result.
|
|
28
28
|
exports.reporter = async (page, withItems) => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
//
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return zIndex !== 'auto' ? zIndex : null;
|
|
38
|
-
});
|
|
39
|
-
// If it does:
|
|
40
|
-
if (badZ) {
|
|
41
|
-
// Add the locator to the array of violators.
|
|
42
|
-
all.locs.push([loc, badZ]);
|
|
29
|
+
const getBadWhat = element => {
|
|
30
|
+
// Get whether the element violates the rule.
|
|
31
|
+
const styleDec = window.getComputedStyle(element);
|
|
32
|
+
const {zIndex} = styleDec;
|
|
33
|
+
// If the Z index of the element is neither 'auto' nor 0:
|
|
34
|
+
if (! ['auto', '0'].includes(zIndex)) {
|
|
35
|
+
// Return a violation description.
|
|
36
|
+
return `z-index style property of the element is ${zIndex}`;
|
|
43
37
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return await getRuleResult(withItems, all, 'zIndex', whats, 0);
|
|
38
|
+
};
|
|
39
|
+
const whats = 'Elements have non-default Z indexes';
|
|
40
|
+
return await doTest(
|
|
41
|
+
page, withItems, 'zIndex', 'body *', whats, 0, null, getBadWhat.toString()
|
|
42
|
+
);
|
|
50
43
|
};
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<html lang="en-US">
|
|
12
12
|
<head>
|
|
13
13
|
<meta charset="utf-8">
|
|
14
|
-
<title>Page with variously sized interaction targets</title>
|
|
14
|
+
<title>Page with variously sized and spaced interaction targets</title>
|
|
15
15
|
<meta name="description" content="tester">
|
|
16
16
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
17
17
|
<style>
|
|
@@ -34,6 +34,10 @@
|
|
|
34
34
|
padding-top: 0;
|
|
35
35
|
padding-bottom: 0;
|
|
36
36
|
}
|
|
37
|
+
button.tiny {
|
|
38
|
+
width: 0.25rem;
|
|
39
|
+
height: 0.25rem;
|
|
40
|
+
}
|
|
37
41
|
#defaultbutton {
|
|
38
42
|
min-height: 25px;
|
|
39
43
|
}
|
|
@@ -49,9 +53,12 @@
|
|
|
49
53
|
<h1>Page with variously sized interaction targets</h1>
|
|
50
54
|
<h2>Buttons</h2>
|
|
51
55
|
<p>Here are three buttons:</p>
|
|
52
|
-
<p><button style="min-width: 3rem; min-height: 3rem" type="button">
|
|
53
|
-
<p><button id="defaultbutton" type="button">
|
|
54
|
-
<p><button style="height: 1.25rem" type="button">
|
|
56
|
+
<p><button style="min-width: 3rem; min-height: 3rem" type="button">Very big</button></p>
|
|
57
|
+
<p><button id="defaultbutton" type="button">Big</button></p>
|
|
58
|
+
<p><button style="height: 1.25rem" type="button">Moderate</button></p>
|
|
59
|
+
<p>Here are three more that are tiny:</p>
|
|
60
|
+
<p><button class="tiny" type="button">X</button><button class="tiny" type="button">Y</button><button class="tiny" type="button">Z</button></p>
|
|
61
|
+
<p><button style="width: 0.5rem; height: 0.5rem" type="button"></button></p>
|
|
55
62
|
<h2>Inputs</h2>
|
|
56
63
|
<p>Here are three inputs:</p>
|
|
57
64
|
<p><label>Big box: <input style="min-width: 3rem; min-height: 3rem" size="20" maxlength="30"></label></p>
|
|
@@ -68,9 +75,7 @@
|
|
|
68
75
|
<li style="min-height: 3rem">W3C: <a class="deep" href="https://w3c.org">World Wide Web Consortium (big)</a></li>
|
|
69
76
|
<li>WF: <a href="https://wikimedia.org">Wikimedia Foundation (small but inline)</a></li>
|
|
70
77
|
<li>WF: <a href="https://wikimedia.org">Wikimedia Foundation (tiny but inline)</a></li>
|
|
71
|
-
<
|
|
72
|
-
<p>Small: 2 buttons, 2 inputs, 2 links</p>
|
|
73
|
-
<p>Tiny: 1 button, 1 input, 1 link</p>
|
|
78
|
+
<p>Violations to be determined after refactoring and redefinition</p>
|
|
74
79
|
</ul>
|
|
75
80
|
</main>
|
|
76
81
|
</body>
|