testaro 18.12.0 → 18.13.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/README.md +10 -10
- package/package.json +1 -1
- package/testaro/zIndex.js +21 -57
package/README.md
CHANGED
|
@@ -59,20 +59,20 @@ Some of the rules tested by Testaro are based on rules of the [BBC Accessibility
|
|
|
59
59
|
|
|
60
60
|
## Rules
|
|
61
61
|
|
|
62
|
-
Each tool accessed with Testaro defines _rules_ and tests _targets_ for compliance with its rules. The counts of the rules range from about
|
|
62
|
+
Each tool accessed with Testaro defines _rules_ and tests _targets_ for compliance with its rules. The counts of the rules range from about 40, for Testaro itself, to about 270, for Continuum Community Edition. In total, the nine tools define about 920 rules. Some of the tools are under active development, and their rule counts change over time.
|
|
63
63
|
|
|
64
64
|
When you ask Testaro to run tests of a tool, you may specify a subset of the rules of that tool, and the report will give you the results of only the tests for those rules. These tools will perform only those tests:
|
|
65
|
-
- alfa
|
|
66
|
-
- axe
|
|
67
|
-
- continuum
|
|
68
|
-
- htmlcs
|
|
69
|
-
- qualWeb
|
|
70
|
-
- testaro
|
|
65
|
+
- `alfa`
|
|
66
|
+
- `axe`
|
|
67
|
+
- `continuum`
|
|
68
|
+
- `htmlcs`
|
|
69
|
+
- `qualWeb`
|
|
70
|
+
- `testaro`
|
|
71
71
|
|
|
72
72
|
These tools always perform a fixed set of tests, and Testaro disregards irrelevant results when you specify a set of rules:
|
|
73
|
-
- ibm
|
|
74
|
-
- nuVal
|
|
75
|
-
- wave
|
|
73
|
+
- `ibm`
|
|
74
|
+
- `nuVal`
|
|
75
|
+
- `wave`
|
|
76
76
|
|
|
77
77
|
## Job data
|
|
78
78
|
|
package/package.json
CHANGED
package/testaro/zIndex.js
CHANGED
|
@@ -10,68 +10,32 @@
|
|
|
10
10
|
|
|
11
11
|
// ########## IMPORTS
|
|
12
12
|
|
|
13
|
-
// Module to
|
|
14
|
-
const {
|
|
13
|
+
// Module to perform common operations.
|
|
14
|
+
const {init, report} = require('../procs/testaro');
|
|
15
15
|
|
|
16
16
|
// ########## FUNCTIONS
|
|
17
17
|
|
|
18
|
+
// Runs the test and returns the result.
|
|
18
19
|
exports.reporter = async (page, withItems) => {
|
|
19
|
-
// Initialize the result.
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// Get its Z index.
|
|
29
|
-
const zIndex = await loc.evaluate(element => {
|
|
30
|
-
const styleDec = window.getComputedStyle(element);
|
|
31
|
-
return styleDec.zIndex;
|
|
20
|
+
// Initialize the locators and result.
|
|
21
|
+
const all = await init(page, 'body *');
|
|
22
|
+
// For each locator:
|
|
23
|
+
for (const loc of all.allLocs) {
|
|
24
|
+
// Get whether its element violates the rule.
|
|
25
|
+
const badZ = await loc.evaluate(el => {
|
|
26
|
+
const styleDec = window.getComputedStyle(el);
|
|
27
|
+
const {zIndex} = styleDec;
|
|
28
|
+
return zIndex !== 'auto' ? zIndex : null;
|
|
32
29
|
});
|
|
33
|
-
// If it
|
|
34
|
-
if (
|
|
35
|
-
// Add to the
|
|
36
|
-
|
|
37
|
-
// If itemization is required:
|
|
38
|
-
if (withItems) {
|
|
39
|
-
// Get data on the element.
|
|
40
|
-
const elData = await getLocatorData(loc);
|
|
41
|
-
// Add an instance to the result.
|
|
42
|
-
standardInstances.push({
|
|
43
|
-
ruleID: 'zIndex',
|
|
44
|
-
what: `Element has a non-default Z index (${zIndex})`,
|
|
45
|
-
ordinalSeverity: 0,
|
|
46
|
-
tagName: elData.tagName,
|
|
47
|
-
id: elData.id,
|
|
48
|
-
location: elData.location,
|
|
49
|
-
excerpt: elData.excerpt
|
|
50
|
-
});
|
|
51
|
-
}
|
|
30
|
+
// If it does:
|
|
31
|
+
if (badZ) {
|
|
32
|
+
// Add the locator to the array of violators.
|
|
33
|
+
all.locs.push([loc, badZ]);
|
|
52
34
|
}
|
|
53
35
|
}
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
what: 'Elements have non-default Z indexes',
|
|
60
|
-
count: totals[0],
|
|
61
|
-
ordinalSeverity: 0,
|
|
62
|
-
tagName: '',
|
|
63
|
-
id: '',
|
|
64
|
-
location: {
|
|
65
|
-
doc: '',
|
|
66
|
-
type: '',
|
|
67
|
-
spec: ''
|
|
68
|
-
},
|
|
69
|
-
excerpt: ''
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
return {
|
|
73
|
-
data,
|
|
74
|
-
totals,
|
|
75
|
-
standardInstances
|
|
76
|
-
};
|
|
36
|
+
// Populate and return the result.
|
|
37
|
+
const whats = [
|
|
38
|
+
'Element has a non-default Z index (__param__)', 'Elements have non-default Z indexes'
|
|
39
|
+
];
|
|
40
|
+
return await report(withItems, all, 'zIndex', whats, 0);
|
|
77
41
|
};
|