testilo 3.9.9 → 3.9.10
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/procs/score/spA11yMessage.js +21 -17
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
This proc computes a score that is intended to represent how accessibly a web page offers
|
|
11
11
|
a user an opportunity to report an accessibility issue about that page. Scores can range
|
|
12
|
-
from 0 to
|
|
12
|
+
from 0 to 16.
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
// CONSTANTS
|
|
@@ -52,35 +52,39 @@ exports.scorer = async report => {
|
|
|
52
52
|
};
|
|
53
53
|
const {score} = report;
|
|
54
54
|
if (Array.isArray(acts)) {
|
|
55
|
-
// Act 1: page
|
|
55
|
+
// Act 1: page loads.
|
|
56
56
|
if (acts[1].result.startsWith('http')) {
|
|
57
57
|
score.page = 2;
|
|
58
|
-
// Act 2:
|
|
58
|
+
// Act 2: accessibility link exists and loads promptly.
|
|
59
59
|
if (acts[2].result.move === 'clicked') {
|
|
60
60
|
score.a11yLink = 2;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
const loadScore = ['incomplete', 'loaded', 'idle'].indexOf(acts[2].result.loadState);
|
|
62
|
+
if (loadScore > -1) {
|
|
63
|
+
score.a11yLink += loadScore;
|
|
64
|
+
}
|
|
65
|
+
// Act 3: next page has an accessibility title.
|
|
66
|
+
const act3Result = acts[3].result;
|
|
67
|
+
if (act3Result && act3Result.toLowerCase().includes('accessibility')) {
|
|
64
68
|
score.title = 2;
|
|
65
|
-
// Act
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
69
|
+
// Act 4: page has exactly 1 h1 heading.
|
|
70
|
+
const act4Result = acts[4].result;
|
|
71
|
+
if (act4Result && act4Result.total === 1) {
|
|
68
72
|
score.heading = 1;
|
|
69
|
-
// Act
|
|
70
|
-
if (
|
|
73
|
+
// Act 4: h1 is an accessibility heading.
|
|
74
|
+
if (act4Result.items[0].textContent.toLowerCase().includes('accessibility')) {
|
|
71
75
|
score.heading += 1;
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
}
|
|
79
|
+
// Act 5: page has accessibility email and telephone links.
|
|
80
|
+
const act5Result = acts[5].result;
|
|
81
|
+
if (act5Result.total) {
|
|
82
|
+
contactScorer(act5Result, score, 'mailLink');
|
|
83
|
+
}
|
|
75
84
|
// Act 6: page has accessibility email and telephone links.
|
|
76
85
|
const act6Result = acts[6].result;
|
|
77
86
|
if (act6Result.total) {
|
|
78
|
-
contactScorer(act6Result, score, '
|
|
79
|
-
}
|
|
80
|
-
// Act 7: page has accessibility email and telephone links.
|
|
81
|
-
const act7Result = acts[7].result;
|
|
82
|
-
if (act7Result.total) {
|
|
83
|
-
contactScorer(act7Result, score, 'telLink');
|
|
87
|
+
contactScorer(act6Result, score, 'telLink');
|
|
84
88
|
}
|
|
85
89
|
}
|
|
86
90
|
}
|