testaro 58.3.2 → 58.3.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/package.json +1 -1
- package/testaro/headEl.js +46 -61
- package/tests/ibm.js +0 -1
package/package.json
CHANGED
package/testaro/headEl.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
© 2023–2024 CVS Health and/or one of its affiliates. All rights reserved.
|
|
3
|
+
© 2025 Jonathan Robert Pool. All rights reserved.
|
|
3
4
|
|
|
4
5
|
MIT License
|
|
5
6
|
|
|
@@ -25,14 +26,9 @@
|
|
|
25
26
|
/*
|
|
26
27
|
headEl
|
|
27
28
|
Related to ASLint rule elements-not-allowed-in-head.
|
|
28
|
-
This test reports invalid descendants of the head
|
|
29
|
+
This test reports invalid descendants of the head of the document.
|
|
29
30
|
*/
|
|
30
31
|
|
|
31
|
-
// ########## IMPORTS
|
|
32
|
-
|
|
33
|
-
// Module to get the document source.
|
|
34
|
-
const {getSource} = require('../procs/getSource');
|
|
35
|
-
|
|
36
32
|
// ########## FUNCTIONS
|
|
37
33
|
|
|
38
34
|
// Performs the test.
|
|
@@ -44,63 +40,52 @@ exports.reporter = async page => {
|
|
|
44
40
|
};
|
|
45
41
|
let totals = [];
|
|
46
42
|
const standardInstances = [];
|
|
47
|
-
// Get the
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
'NOSCRIPT',
|
|
75
|
-
'TEMPLATE'
|
|
76
|
-
];
|
|
77
|
-
// For each tag name:
|
|
78
|
-
ucTagNames.forEach(tagName => {
|
|
79
|
-
// If it is invalid:
|
|
80
|
-
if (! validTagNames.includes(tagName)) {
|
|
81
|
-
// Add this to the result.
|
|
82
|
-
data.total++;
|
|
83
|
-
data.badTagNames.push(tagName);
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
// If there are any instances:
|
|
87
|
-
if (data.total) {
|
|
88
|
-
// Add a summary instance.
|
|
89
|
-
standardInstances.push({
|
|
90
|
-
ruleID: 'headEl',
|
|
91
|
-
what: `Invalid elements within the head: ${data.badTagNames.join(', ')}`,
|
|
92
|
-
ordinalSeverity: 2,
|
|
93
|
-
count: data.total,
|
|
94
|
-
location: {
|
|
95
|
-
doc: '',
|
|
96
|
-
type: '',
|
|
97
|
-
spec: ''
|
|
98
|
-
},
|
|
99
|
-
excerpt: ''
|
|
100
|
-
});
|
|
43
|
+
// Get the tag names of the elements in the head, even if the head tags are omitted.
|
|
44
|
+
const headElTagNames = await page.evaluate(() => {
|
|
45
|
+
const head = document.head;
|
|
46
|
+
const headChildren = head.children;
|
|
47
|
+
const tagNames = [];
|
|
48
|
+
for (const child of headChildren) {
|
|
49
|
+
tagNames.push(child.tagName);
|
|
50
|
+
}
|
|
51
|
+
return tagNames;
|
|
52
|
+
});
|
|
53
|
+
const validTagNames = [
|
|
54
|
+
'BASE',
|
|
55
|
+
'LINK',
|
|
56
|
+
'META',
|
|
57
|
+
'SCRIPT',
|
|
58
|
+
'STYLE',
|
|
59
|
+
'TITLE',
|
|
60
|
+
'NOSCRIPT',
|
|
61
|
+
'TEMPLATE'
|
|
62
|
+
];
|
|
63
|
+
// For each head child:
|
|
64
|
+
headElTagNames.forEach(tagName => {
|
|
65
|
+
// If it is invalid:
|
|
66
|
+
if (! validTagNames.includes(tagName)) {
|
|
67
|
+
// Add its tag name to the result.
|
|
68
|
+
data.total++;
|
|
69
|
+
data.badTagNames.push(tagName);
|
|
101
70
|
}
|
|
102
|
-
|
|
71
|
+
});
|
|
72
|
+
// If there are any instances:
|
|
73
|
+
if (data.total) {
|
|
74
|
+
// Add a summary instance.
|
|
75
|
+
standardInstances.push({
|
|
76
|
+
ruleID: 'headEl',
|
|
77
|
+
what: `Invalid elements within the head: ${data.badTagNames.join(', ')}`,
|
|
78
|
+
ordinalSeverity: 2,
|
|
79
|
+
count: data.total,
|
|
80
|
+
location: {
|
|
81
|
+
doc: '',
|
|
82
|
+
type: '',
|
|
83
|
+
spec: ''
|
|
84
|
+
},
|
|
85
|
+
excerpt: ''
|
|
86
|
+
});
|
|
103
87
|
}
|
|
88
|
+
totals = [0, 0, data.total, 0];
|
|
104
89
|
// Return the data.
|
|
105
90
|
return {
|
|
106
91
|
data,
|
package/tests/ibm.js
CHANGED
|
@@ -183,7 +183,6 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
|
|
|
183
183
|
const act = report.acts[actIndex];
|
|
184
184
|
const {withItems, withNewContent, rules} = act;
|
|
185
185
|
const contentType = withNewContent ? 'new' : 'existing';
|
|
186
|
-
console.log(`>>>>>> Content type: ${contentType}`);
|
|
187
186
|
try {
|
|
188
187
|
const typeContent = contentType === 'existing' ? await page.content() : page.url();
|
|
189
188
|
// Perform the tests.
|