testaro 77.0.4 → 77.2.0

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.
Files changed (62) hide show
  1. package/package.json +1 -1
  2. package/procs/catalog.js +30 -14
  3. package/procs/testaro.js +6 -6
  4. package/procs/xPath.js +9 -7
  5. package/testaro/adbID.js +1 -1
  6. package/testaro/allCapStyle.js +1 -1
  7. package/testaro/allHidden.js +1 -1
  8. package/testaro/allSlanted.js +1 -1
  9. package/testaro/altScheme.js +1 -1
  10. package/testaro/attVal.js +1 -1
  11. package/testaro/autocomplete.js +1 -1
  12. package/testaro/bulk.js +1 -1
  13. package/testaro/buttonMenu.js +3 -3
  14. package/testaro/captionLoc.js +1 -1
  15. package/testaro/datalistRef.js +1 -1
  16. package/testaro/distortion.js +1 -1
  17. package/testaro/docType.js +5 -1
  18. package/testaro/dupAtt.js +1 -1
  19. package/testaro/embAc.js +1 -1
  20. package/testaro/focAll.js +1 -1
  21. package/testaro/focAndOp.js +1 -1
  22. package/testaro/focInd.js +1 -1
  23. package/testaro/focVis.js +1 -1
  24. package/testaro/headEl.js +1 -1
  25. package/testaro/headingAmb.js +1 -1
  26. package/testaro/hovInd.js +1 -1
  27. package/testaro/hover.js +1 -1
  28. package/testaro/hr.js +1 -1
  29. package/testaro/imageLink.js +1 -1
  30. package/testaro/labClash.js +1 -1
  31. package/testaro/legendLoc.js +1 -1
  32. package/testaro/lineHeight.js +1 -1
  33. package/testaro/linkAmb.js +1 -1
  34. package/testaro/linkExt.js +1 -1
  35. package/testaro/linkOldAtt.js +1 -1
  36. package/testaro/linkTo.js +1 -1
  37. package/testaro/linkUl.js +1 -1
  38. package/testaro/miniText.js +1 -1
  39. package/testaro/motion.js +1 -1
  40. package/testaro/nonTable.js +1 -1
  41. package/testaro/optRoleSel.js +1 -1
  42. package/testaro/phOnly.js +1 -1
  43. package/testaro/pseudoP.js +1 -1
  44. package/testaro/radioSet.js +1 -1
  45. package/testaro/role.js +1 -1
  46. package/testaro/secHeading.js +1 -1
  47. package/testaro/styleDiff.js +1 -1
  48. package/testaro/tabNav.js +1 -1
  49. package/testaro/targetsNear.js +1 -1
  50. package/testaro/textSem.js +1 -1
  51. package/testaro/titledEl.js +1 -1
  52. package/testaro/zIndex.js +1 -1
  53. package/tests/alfa.js +1 -2
  54. package/tests/aslint.js +1 -2
  55. package/tests/axe.js +1 -1
  56. package/tests/ed11y.js +1 -1
  57. package/tests/htmlcs.js +1 -1
  58. package/tests/ibm.js +1 -1
  59. package/tests/nuVal.js +1 -1
  60. package/tests/nuVnu.js +1 -1
  61. package/tests/qualWeb.js +1 -1
  62. package/tests/wave.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "77.0.4",
3
+ "version": "77.2.0",
4
4
  "description": "Run 1300 web accessibility tests from 10 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/procs/catalog.js CHANGED
@@ -44,6 +44,18 @@ exports.getCatalog = async report => {
44
44
  });
45
45
  // If the launch and navigation succeeded:
46
46
  if (page) {
47
+ // Expand closed details elements before the page image and the box measurements, so
48
+ // both see the same fully disclosed state. Chromium lays out the content of a closed
49
+ // details element (content-visibility: hidden) without painting it and without
50
+ // shifting the content after it, so getBoundingClientRect returns coordinates that
51
+ // overlap unrelated visible elements, making box IDs disagree with the page image.
52
+ await page.evaluate(() => {
53
+ document.querySelectorAll('details:not([open])').forEach(details => {
54
+ details.setAttribute('open', '');
55
+ });
56
+ }).catch(error => {
57
+ console.log(`ERROR: Expanding details elements failed (${error.message})`);
58
+ });
47
59
  // If a page image is required:
48
60
  if ([0, 2, 4, 6].includes(report.imageColor)) {
49
61
  // Create one and add it to the report.
@@ -54,12 +66,14 @@ exports.getCatalog = async report => {
54
66
  action: 'report'
55
67
  });
56
68
  }
57
- // Get a catalog of the elements in the page.
69
+ // Get a catalog of the elements in the page and a map of path IDs to catalog indexes.
58
70
  console.log('Creating catalog');
59
- const catalog = await page.evaluate(() => {
71
+ const {cat: catalog, pathIDs} = await page.evaluate(() => {
60
72
  const elements = Array.from(document.querySelectorAll('*'));
61
73
  // Initialize a catalog.
62
74
  const cat = {};
75
+ // Initialize a map of path IDs to catalog indexes.
76
+ const pathIDs = {};
63
77
  // Initialize a directory of text fragments.
64
78
  const texts = {};
65
79
  // Initialize the index of the current heading.
@@ -132,9 +146,8 @@ exports.getCatalog = async report => {
132
146
  // Assign its index to the current heading index.
133
147
  headingIndex = index;
134
148
  }
135
- // Add the path ID to the temporary path ID property of the catalog.
136
- cat.pathID ??= {};
137
- cat.pathID[pathID] = index;
149
+ // Add the path ID to the map of path IDs.
150
+ pathIDs[pathID] = index;
138
151
  }
139
152
  // For each text in the catalog:
140
153
  Object.keys(texts).forEach(text => {
@@ -160,8 +173,10 @@ exports.getCatalog = async report => {
160
173
  });
161
174
  }
162
175
  });
163
- return cat;
176
+ return {cat, pathIDs};
164
177
  });
178
+ // Add the map of path IDs to the report as a temporary job-time property.
179
+ report.pathIDs = pathIDs;
165
180
  // Close the browser and its context.
166
181
  await browserClose(page);
167
182
  // Return the catalog.
@@ -188,22 +203,23 @@ exports.pruneCatalog = report => {
188
203
  // For each instance of the standard result:
189
204
  instances.forEach(instance => {
190
205
  const catalogIndex = instance?.catalogIndex;
191
- // If the instance has a catalog index:
192
- if (catalogIndex) {
193
- // Ensure the index is classified as cited.
194
- citedElementIndexes.add(catalogIndex);
195
- const {headingIndex} = catalog[catalogIndex];
206
+ // If the instance has a catalog index (an index of '0' counts, so test for presence):
207
+ if (catalogIndex !== undefined && catalogIndex !== '') {
208
+ // Ensure the index is classified as cited, as a string so it matches the
209
+ // catalog keys tested below (Object.keys() yields strings).
210
+ citedElementIndexes.add(String(catalogIndex));
211
+ const {headingIndex} = catalog[catalogIndex] ?? {};
196
212
  // If the catalog item has a heading index:
197
213
  if (headingIndex) {
198
214
  // Ensure it, too, is classified as cited.
199
- citedElementIndexes.add(headingIndex);
215
+ citedElementIndexes.add(String(headingIndex));
200
216
  }
201
217
  }
202
218
  });
203
219
  }
204
220
  });
205
- // Delete the temporary path ID property.
206
- delete catalog.pathID;
221
+ // Delete the temporary path ID map of the report.
222
+ delete report.pathIDs;
207
223
  // For each element in the catalog:
208
224
  Object.keys(catalog).forEach(elementIndex => {
209
225
  // If it is not cited by any instance or by any cited element:
package/procs/testaro.js CHANGED
@@ -22,7 +22,7 @@ const {getXPathCatalogIndex} = require('./xPath');
22
22
  // Tests for a testaro rule.
23
23
  exports.doTest = async (
24
24
  page,
25
- catalog,
25
+ report,
26
26
  withItems,
27
27
  ruleID,
28
28
  candidateSelector,
@@ -122,7 +122,7 @@ exports.doTest = async (
122
122
  // If the proto-instance includes an XPath:
123
123
  if (xPath) {
124
124
  // Add the catalog index to the standard instance.
125
- standardInstance.catalogIndex = getXPathCatalogIndex(catalog, xPath);
125
+ standardInstance.catalogIndex = getXPathCatalogIndex(report, xPath);
126
126
  }
127
127
  // Add the standard instance to the standard instances.
128
128
  standardInstances.push(standardInstance);
@@ -152,17 +152,17 @@ exports.doTest = async (
152
152
  };
153
153
  };
154
154
  // Adds a catalog index or, if necessary, an XPath to a proto-instance.
155
- const addCatalogIndex = async (protoInstance, locator, catalog) => {
155
+ const addCatalogIndex = async (protoInstance, locator, report) => {
156
156
  // Get the XPath of the element referenced by the locator.
157
157
  const xPath = await locator.evaluate(element => window.getXPath(element) ?? '/html');
158
158
  // Add a catalog index to the proto-instance.
159
- protoInstance.catalogIndex = getXPathCatalogIndex(catalog, xPath);
159
+ protoInstance.catalogIndex = getXPathCatalogIndex(report, xPath);
160
160
  // Return the proto-instance with any modification.
161
161
  return protoInstance;
162
162
  };
163
163
  // Tests for a doTest-ineligible Testaro rule.
164
164
  exports.getBasicResult = async (
165
- catalog, withItems, ruleID, ordinalSeverity, whats, data, violations
165
+ report, withItems, ruleID, ordinalSeverity, whats, data, violations
166
166
  ) => {
167
167
  // If the test was prevented:
168
168
  if (data.prevented) {
@@ -190,7 +190,7 @@ exports.getBasicResult = async (
190
190
  count: 1
191
191
  };
192
192
  // Add a catalog index to it.
193
- addCatalogIndex(protoInstance, loc, catalog);
193
+ addCatalogIndex(protoInstance, loc, report);
194
194
  // Add the standard instance to the standard instances.
195
195
  standardInstances.push(protoInstance);
196
196
  }
package/procs/xPath.js CHANGED
@@ -65,18 +65,20 @@ const getXPathTagName = xPath => {
65
65
  return xPath.split('/').pop().replace(/\[.+/, '').toUpperCase();
66
66
  };
67
67
  // Gets a catalog index as a string from an XPath.
68
- exports.getXPathCatalogIndex = (catalog, xPath) => {
68
+ exports.getXPathCatalogIndex = (report, xPath) => {
69
+ const {catalog} = report;
70
+ report.pathIDs ??= {};
69
71
  // Get the index of the catalog item with the XPath.
70
- const index = catalog.pathID[xPath];
71
- // If no such item exists:
72
- if (! index) {
73
- // Add an item to the catalog.
74
- const newIndex = Object.keys(catalog).length;
72
+ const index = report.pathIDs[xPath];
73
+ // If no such item exists (an index of '0' is a match, so test for absence, not falsity):
74
+ if (index === undefined) {
75
+ // Add an item to the catalog, keyed by the count of items already in it.
76
+ const newIndex = `${Object.keys(catalog).length}`;
75
77
  catalog[newIndex] = {
76
78
  pathID: xPath,
77
79
  tagName: getXPathTagName(xPath)
78
80
  };
79
- catalog.pathID[xPath] = `${newIndex}`;
81
+ report.pathIDs[xPath] = newIndex;
80
82
  return newIndex;
81
83
  }
82
84
  return index;
package/testaro/adbID.js CHANGED
@@ -57,6 +57,6 @@ exports.reporter = async (page, report, _, withItems) => {
57
57
  };
58
58
  const whats = 'Elements have aria-describedby attributes with missing or invalid id values';
59
59
  return await doTest(
60
- page, report.catalog, withItems, 'adbID', 'body [aria-describedby]', whats, 3, getBadWhat.toString()
60
+ page, report, withItems, 'adbID', 'body [aria-describedby]', whats, 3, getBadWhat.toString()
61
61
  );
62
62
  };
@@ -46,6 +46,6 @@ exports.reporter = async (page, report, _, withItems) => {
46
46
  const selector = 'body, body *:not(style, script, svg)';
47
47
  const whats = 'Elements have an all-capital text transformation style';
48
48
  return await doTest(
49
- page, report.catalog, withItems, 'allCapStyle', selector, whats, 0, getBadWhat.toString()
49
+ page, report, withItems, 'allCapStyle', selector, whats, 0, getBadWhat.toString()
50
50
  );
51
51
  };
@@ -33,7 +33,7 @@ exports.reporter = async (page, report) => {
33
33
  what: 'The entire page body is hidden or empty',
34
34
  ordinalSeverity: 3,
35
35
  count: 1,
36
- catalogIndex: getXPathCatalogIndex(report.catalog, '/html/body')
36
+ catalogIndex: getXPathCatalogIndex(report, '/html/body')
37
37
  }]
38
38
  };
39
39
  }
@@ -45,6 +45,6 @@ exports.reporter = async (page, report, _, withItems) => {
45
45
  const selector = 'body, body *:not(style, script, svg)';
46
46
  const whats = 'Elements contain all-slanted text';
47
47
  return await doTest(
48
- page, report.catalog, withItems, 'allSlanted', selector, whats, 0, getBadWhat.toString()
48
+ page, report, withItems, 'allSlanted', selector, whats, 0, getBadWhat.toString()
49
49
  );
50
50
  };
@@ -41,6 +41,6 @@ exports.reporter = async (page, report, _, withItems) => {
41
41
  };
42
42
  const whats = 'img elements have alt attributes with URL or filename values';
43
43
  return await doTest(
44
- page, report.catalog, withItems, 'altScheme', 'body img[alt]', whats, 1, getBadWhat.toString()
44
+ page, report, withItems, 'altScheme', 'body img[alt]', whats, 1, getBadWhat.toString()
45
45
  );
46
46
  };
package/testaro/attVal.js CHANGED
@@ -31,6 +31,6 @@ exports.reporter = async (page, report, _0, withItems, attributeName, areLicit,
31
31
  };
32
32
  const whats = `Elements have attribute ${attributeName} with illicit values`;
33
33
  return await doTest(
34
- page, report.catalog, withItems, 'attVal', `body [${attributeName}]`, whats, 2, getBadWhat.toString()
34
+ page, report, withItems, 'attVal', `body [${attributeName}]`, whats, 2, getBadWhat.toString()
35
35
  );
36
36
  };
@@ -91,6 +91,6 @@ exports.reporter = async (
91
91
  getBadWhatString = getBadWhatString.replace(placeHolders[index], replacers[index]);
92
92
  });
93
93
  return doTest(
94
- page, report.catalog, withItems, 'autocomplete', selector, whats, 2, getBadWhatString
94
+ page, report, withItems, 'autocomplete', selector, whats, 2, getBadWhatString
95
95
  );
96
96
  };
package/testaro/bulk.js CHANGED
@@ -38,7 +38,7 @@ exports.reporter = async (page, report) => {
38
38
  what: `Page contains ${visibleElementCount} visible elements`,
39
39
  ordinalSeverity: severity,
40
40
  count: 1,
41
- catalogIndex: getXPathCatalogIndex(report.catalog, '/html')
41
+ catalogIndex: getXPathCatalogIndex(report, '/html')
42
42
  }]
43
43
  };
44
44
  }
@@ -15,7 +15,7 @@
15
15
 
16
16
  // IMPORTS
17
17
 
18
- const {addCatalogIndex} = require('../procs/catalog');
18
+ const {getXPathCatalogIndex} = require('../procs/xPath');
19
19
 
20
20
  // ########## FUNCTIONS
21
21
 
@@ -304,7 +304,7 @@ exports.reporter = async (page, report, _0, withItems, trialKeySpecs = []) => {
304
304
  what: `Menu responds nonstandardly to the ${key} key`,
305
305
  ordinalSeverity: 2,
306
306
  count: 1,
307
- catalogIndex: getXPathCatalogIndex(report.catalog, mbXPath)
307
+ catalogIndex: getXPathCatalogIndex(report, mbXPath)
308
308
  });
309
309
  }
310
310
  // Stop testing the menu button.
@@ -339,7 +339,7 @@ exports.reporter = async (page, report, _0, withItems, trialKeySpecs = []) => {
339
339
  what: 'Menu button does not control exactly 1 menu',
340
340
  ordinalSeverity: 2,
341
341
  count: 1,
342
- catalogIndex: getXPathCatalogIndex(report.catalog, mbXPath)
342
+ catalogIndex: getXPathCatalogIndex(report, mbXPath)
343
343
  });
344
344
  }
345
345
  }
@@ -31,6 +31,6 @@ exports.reporter = async (page, report, _, withItems) => {
31
31
  };
32
32
  const whats = 'caption elements are not the first children of table elements';
33
33
  return await doTest(
34
- page, report.catalog, withItems, 'captionLoc', 'body caption', whats, 3, getBadWhat.toString()
34
+ page, report, withItems, 'captionLoc', 'body caption', whats, 3, getBadWhat.toString()
35
35
  );
36
36
  };
@@ -46,6 +46,6 @@ exports.reporter = async (page, report, _, withItems) => {
46
46
  };
47
47
  const whats = 'list attributes of input elements are empty or IDs of no or non-datalist elements';
48
48
  return await doTest(
49
- page, report.catalog, withItems, 'datalistRef', 'body input[list]', whats, 3, getBadWhat.toString()
49
+ page, report, withItems, 'datalistRef', 'body input[list]', whats, 3, getBadWhat.toString()
50
50
  );
51
51
  };
@@ -38,6 +38,6 @@ exports.reporter = async (page, report, _, withItems) => {
38
38
  };
39
39
  const whats = 'Elements distort their texts';
40
40
  return await doTest(
41
- page, report.catalog, withItems, 'distortion', 'body, body *', whats, 0, getBadWhat.toString()
41
+ page, report, withItems, 'distortion', 'body, body *', whats, 0, getBadWhat.toString()
42
42
  );
43
43
  };
@@ -14,6 +14,10 @@
14
14
  This test reports a failure to equip the page document with a W3C-recommended HTML doctype.
15
15
  */
16
16
 
17
+ // IMPORTS
18
+
19
+ const {getXPathCatalogIndex} = require('../procs/xPath');
20
+
17
21
  // Runs the test and returns the result.
18
22
  exports.reporter = async (page, report) => {
19
23
  // Returns whether the page declares a document type.
@@ -31,7 +35,7 @@ exports.reporter = async (page, report) => {
31
35
  what: 'Document has no standard HTML doctype preamble',
32
36
  ordinalSeverity: 3,
33
37
  count: 1,
34
- catalogIndex: getXPathCatalogIndex('/html')
38
+ catalogIndex: getXPathCatalogIndex(report, '/html')
35
39
  }]
36
40
  };
37
41
  };
package/testaro/dupAtt.js CHANGED
@@ -96,7 +96,7 @@ exports.reporter = async (page, report, _, withItems) => {
96
96
  what: `${item.tagName} element has 2 attributes named ${item.duplicatedAttribute}`,
97
97
  ordinalSeverity: 2,
98
98
  count: 1,
99
- catalogIndex: getXPathCatalogIndex(report.catalog, '/html/body')
99
+ catalogIndex: getXPathCatalogIndex(report, '/html/body')
100
100
  });
101
101
  });
102
102
  }
package/testaro/embAc.js CHANGED
@@ -32,5 +32,5 @@ exports.reporter = async (page, report, _, withItems) => {
32
32
  .map(tag => `a ${tag}, button ${tag}`)
33
33
  .join(', ');
34
34
  const whats = 'interactive elements are embedded in links or buttons';
35
- return await doTest(page, report.catalog, withItems, 'embAc', selector, whats, 2, getBadWhat.toString());
35
+ return await doTest(page, report, withItems, 'embAc', selector, whats, 2, getBadWhat.toString());
36
36
  };
package/testaro/focAll.js CHANGED
@@ -74,7 +74,7 @@ exports.reporter = async (page, report) => {
74
74
  what: 'Some focusable elements are not Tab-focusable or vice versa',
75
75
  ordinalSeverity: 2,
76
76
  count,
77
- catalogIndex: getXPathCatalogIndex(report.catalog, '/html/body')
77
+ catalogIndex: getXPathCatalogIndex(report, '/html/body')
78
78
  }] : []
79
79
  };
80
80
  };
@@ -118,6 +118,6 @@ exports.reporter = async (page, report, _, withItems) => {
118
118
  };
119
119
  const whats = 'Elements are Tab-focusable but not operable or vice versa';
120
120
  return await doTest(
121
- page, report.catalog, withItems, 'focAndOp', 'body, body *', whats, 2, getBadWhat.toString()
121
+ page, report, withItems, 'focAndOp', 'body, body *', whats, 2, getBadWhat.toString()
122
122
  );
123
123
  };
package/testaro/focInd.js CHANGED
@@ -86,6 +86,6 @@ exports.reporter = async (page, report, _, withItems) => {
86
86
  };
87
87
  const whats = 'Elements fail to have standard focus indicators';
88
88
  return await doTest(
89
- page, report.catalog, withItems, 'focInd', 'body, body *', whats, 1, getBadWhat.toString()
89
+ page, report, withItems, 'focInd', 'body, body *', whats, 1, getBadWhat.toString()
90
90
  );
91
91
  };
package/testaro/focVis.js CHANGED
@@ -42,6 +42,6 @@ exports.reporter = async (page, report, _, withItems) => {
42
42
  };
43
43
  const whats = 'Visible links are above or to the left of the display';
44
44
  return await doTest(
45
- page, report.catalog, withItems, 'focVis', 'body a', whats, 2, getBadWhat.toString()
45
+ page, report, withItems, 'focVis', 'body a', whats, 2, getBadWhat.toString()
46
46
  );
47
47
  };
package/testaro/headEl.js CHANGED
@@ -65,7 +65,7 @@ exports.reporter = async (page, report) => {
65
65
  what: `Invalid elements within the head: ${data.badTagNames.join(', ')}`,
66
66
  ordinalSeverity: 2,
67
67
  count: data.total,
68
- catalogIndex: getXPathCatalogIndex(report.catalog, '/html/head')
68
+ catalogIndex: getXPathCatalogIndex(report, '/html/head')
69
69
  });
70
70
  }
71
71
  totals = [0, 0, data.total, 0];
@@ -70,6 +70,6 @@ exports.reporter = async (page, report, _, withItems) => {
70
70
  const selector = headingLevels.map(level => `body h${level}`).join(', ');
71
71
  const whats = 'Adjacent sibling same-level headings have the same text';
72
72
  return await doTest(
73
- page, report.catalog, withItems, 'headingAmb', selector, whats, 1, getBadWhat.toString()
73
+ page, report, withItems, 'headingAmb', selector, whats, 1, getBadWhat.toString()
74
74
  );
75
75
  };
package/testaro/hovInd.js CHANGED
@@ -140,5 +140,5 @@ exports.reporter = async (page, report, _, withItems) => {
140
140
  };
141
141
  const selector = 'body a, body button, body input, body [onmouseenter], body [onmouseover]';
142
142
  const whats = 'elements have confusing hover indicators';
143
- return await doTest(page, report.catalog, withItems, 'hovInd', selector, whats, 1, getBadWhat.toString());
143
+ return await doTest(page, report, withItems, 'hovInd', selector, whats, 1, getBadWhat.toString());
144
144
  };
package/testaro/hover.js CHANGED
@@ -141,5 +141,5 @@ exports.reporter = async (page, report, _, withItems) => {
141
141
  }
142
142
  // Get and return a result.
143
143
  const whats = 'Hovering over elements changes the number of related visible elements';
144
- return await getBasicResult(report.catalog, withItems, 'hover', 0, whats, data, violations);
144
+ return await getBasicResult(report, withItems, 'hover', 0, whats, data, violations);
145
145
  };
package/testaro/hr.js CHANGED
@@ -27,6 +27,6 @@ exports.reporter = async (page, report, _, withItems) => {
27
27
  }
28
28
  const whats = 'HR elements are used for vertical segmentation';
29
29
  return await doTest(
30
- page, report.catalog, withItems, 'hr', 'body hr', whats, 0, getBadWhat.toString()
30
+ page, report, withItems, 'hr', 'body hr', whats, 0, getBadWhat.toString()
31
31
  );
32
32
  };
@@ -33,6 +33,6 @@ exports.reporter = async (page, report, _, withItems) => {
33
33
  };
34
34
  const whats = 'Links have image files as their destinations';
35
35
  return await doTest(
36
- page, report.catalog, withItems, 'imageLink', 'body a[href]', whats, 0, getBadWhat.toString()
36
+ page, report, withItems, 'imageLink', 'body a[href]', whats, 0, getBadWhat.toString()
37
37
  );
38
38
  };
@@ -44,6 +44,6 @@ exports.reporter = async (page, report, _, withItems) => {
44
44
  const selector = 'body button, body input:not([type=hidden]), body select, body textarea';
45
45
  const whats = 'Elements have inconsistent label types';
46
46
  return await doTest(
47
- page, report.catalog, withItems, 'labClash', selector, whats, 2, getBadWhat.toString()
47
+ page, report, withItems, 'labClash', selector, whats, 2, getBadWhat.toString()
48
48
  );
49
49
  };
@@ -33,6 +33,6 @@ exports.reporter = async (page, report, _, withItems) => {
33
33
  };
34
34
  const whats = 'Legend elements are not the first children of fieldset elements';
35
35
  return await doTest(
36
- page, report.catalog, withItems, 'legendLoc', 'body legend', whats, 3, getBadWhat.toString()
36
+ page, report, withItems, 'legendLoc', 'body legend', whats, 3, getBadWhat.toString()
37
37
  );
38
38
  };
@@ -61,6 +61,6 @@ exports.reporter = async (page, report, _, withItems) => {
61
61
  };
62
62
  const whats = 'Element line heights are less than 1.5 times their font sizes';
63
63
  return await doTest(
64
- page, report.catalog, withItems, 'lineHeight', 'body, body *', whats, 1, getBadWhat.toString()
64
+ page, report, withItems, 'lineHeight', 'body, body *', whats, 1, getBadWhat.toString()
65
65
  );
66
66
  };
@@ -22,7 +22,7 @@ const {getXPathCatalogIndex} = require('../procs/xPath');
22
22
 
23
23
  // Runs the test and returns the result.
24
24
  exports.reporter = async (page, report, _, withItems) => {
25
- const catalogIndex = getXPathCatalogIndex(report.catalog, '/html/body');
25
+ const catalogIndex = getXPathCatalogIndex(report, '/html/body');
26
26
  return await page.evaluate(args => {
27
27
  const [withItems, catalogIndex] = args;
28
28
  // Get all links.
@@ -26,6 +26,6 @@ exports.reporter = async (page, report, _, withItems) => {
26
26
  };
27
27
  const whats = 'Links have target=_blank attributes';
28
28
  return await doTest(
29
- page, report.catalog, withItems, 'linkExt', 'body a[target=_blank]', whats, 0, getBadWhat.toString()
29
+ page, report, withItems, 'linkExt', 'body a[target=_blank]', whats, 0, getBadWhat.toString()
30
30
  );
31
31
  };
@@ -39,6 +39,6 @@ exports.reporter = async (page, report, _, withItems) => {
39
39
  const selector = 'body a[charset], body a[coords], body a[name], body a[rev], body a[shape]';
40
40
  const whats = 'Links have deprecated attributes';
41
41
  return await doTest(
42
- page, report.catalog, withItems, 'linkOldAtt', selector, whats, 1, getBadWhat.toString()
42
+ page, report, withItems, 'linkOldAtt', selector, whats, 1, getBadWhat.toString()
43
43
  );
44
44
  };
package/testaro/linkTo.js CHANGED
@@ -33,6 +33,6 @@ exports.reporter = async (page, report, _, withItems) => {
33
33
  };
34
34
  const whats = 'Links are missing href attributes';
35
35
  return await doTest(
36
- page, report.catalog, withItems, 'linkTo', 'body a:not([href]', whats, 2, getBadWhat.toString()
36
+ page, report, withItems, 'linkTo', 'body a:not([href]', whats, 2, getBadWhat.toString()
37
37
  );
38
38
  };
package/testaro/linkUl.js CHANGED
@@ -44,6 +44,6 @@ exports.reporter = async (page, report, _, withItems) => {
44
44
  };
45
45
  const whats = 'Links with adjacent text are not underlined';
46
46
  return await doTest(
47
- page, report.catalog, withItems, 'linkUl', 'body a', whats, 1, getBadWhat.toString()
47
+ page, report, withItems, 'linkUl', 'body a', whats, 1, getBadWhat.toString()
48
48
  );
49
49
  };
@@ -59,6 +59,6 @@ exports.reporter = async (page, report, _, withItems) => {
59
59
  };
60
60
  const whats = 'Visible elements have font sizes smaller than 11 pixels';
61
61
  return await doTest(
62
- page, report.catalog, withItems, 'miniText', 'body, body *:not(script, style)', whats, 2, getBadWhat.toString()
62
+ page, report, withItems, 'miniText', 'body, body *:not(script, style)', whats, 2, getBadWhat.toString()
63
63
  );
64
64
  };
package/testaro/motion.js CHANGED
@@ -90,7 +90,7 @@ exports.reporter = async (page, report) => {
90
90
  what: violationWhat,
91
91
  ordinalSeverity,
92
92
  count: 1,
93
- catalogIndex: getXPathCatalogIndex(report.catalog, '/html/body')
93
+ catalogIndex: getXPathCatalogIndex(report, '/html/body')
94
94
  });
95
95
  }
96
96
  }
@@ -56,6 +56,6 @@ exports.reporter = async (page, report, _, withItems) => {
56
56
  };
57
57
  const whats = 'table elements are misused for non-table content';
58
58
  return await doTest(
59
- page, report.catalog, withItems, 'nonTable', 'body table', whats, 2, getBadWhat.toString()
59
+ page, report, withItems, 'nonTable', 'body table', whats, 2, getBadWhat.toString()
60
60
  );
61
61
  };
@@ -32,6 +32,6 @@ exports.reporter = async (page, report, _, withItems) => {
32
32
  };
33
33
  const whats = 'Elements with role=option have no aria-selected attributes';
34
34
  return await doTest(
35
- page, report.catalog, withItems, 'optRoleSel', 'body [role="option"]', whats, 1, getBadWhat.toString()
35
+ page, report, withItems, 'optRoleSel', 'body [role="option"]', whats, 1, getBadWhat.toString()
36
36
  );
37
37
  };
package/testaro/phOnly.js CHANGED
@@ -34,6 +34,6 @@ exports.reporter = async (page, report, _, withItems) => {
34
34
  };
35
35
  const whats = 'input elements have placeholders but no accessible names';
36
36
  return await doTest(
37
- page, report.catalog, withItems, 'phOnly', 'body input[placeholder]', whats, 2, getBadWhat.toString()
37
+ page, report, withItems, 'phOnly', 'body input[placeholder]', whats, 2, getBadWhat.toString()
38
38
  );
39
39
  };
@@ -49,6 +49,6 @@ exports.reporter = async (page, report, _, withItems) => {
49
49
  };
50
50
  const whats = 'br elements follow other br elements, possibly constituting pseudo-paragraphs';
51
51
  return await doTest(
52
- page, report.catalog, withItems, 'pseudoP', 'body br', whats, 0, getBadWhat.toString()
52
+ page, report, withItems, 'pseudoP', 'body br', whats, 0, getBadWhat.toString()
53
53
  );
54
54
  };
@@ -69,6 +69,6 @@ exports.reporter = async (page, report, _, withItems) => {
69
69
  };
70
70
  const whats = 'Radio buttons are not validly grouped in fieldsets with legends';
71
71
  return await doTest(
72
- page, report.catalog, withItems, 'radioSet', 'body input[type=radio]', whats, 2, getBadWhat.toString()
72
+ page, report, withItems, 'radioSet', 'body input[type=radio]', whats, 2, getBadWhat.toString()
73
73
  );
74
74
  };
package/testaro/role.js CHANGED
@@ -44,5 +44,5 @@ exports.reporter = async (page, report, _, withItems) => {
44
44
  }
45
45
  // Get and return a result.
46
46
  const whats = 'Elements have roles assigned that are also implicit HTML element roles';
47
- return await getBasicResult(report.catalog, withItems, 'role', 0, whats, {}, violations);
47
+ return await getBasicResult(report, withItems, 'role', 0, whats, {}, violations);
48
48
  };
@@ -44,6 +44,6 @@ exports.reporter = async (page, report, _, withItems) => {
44
44
  const selector = 'body section, body article, body nav, body aside, body main';
45
45
  const whats = 'First child headings of sectioning containers are deeper than others';
46
46
  return await doTest(
47
- page, report.catalog, withItems, 'secHeading', selector, whats, 0, getBadWhat.toString()
47
+ page, report, withItems, 'secHeading', selector, whats, 0, getBadWhat.toString()
48
48
  );
49
49
  };
@@ -84,7 +84,7 @@ const linksByType = async page => await page.evaluateHandle(() => {
84
84
  exports.reporter = async (page, report, _, withItems) => {
85
85
  // Get an object with arrays of list links and adjacent links as properties.
86
86
  const linkTypes = await linksByType(page);
87
- const catalogIndex = getXPathCatalogIndex(report.catalog, '/html/body');
87
+ const catalogIndex = getXPathCatalogIndex(report, '/html/body');
88
88
  return await page.evaluate(args => {
89
89
  const [linkTypes, withItems, catalogIndex] = args;
90
90
  const {body} = document;
package/testaro/tabNav.js CHANGED
@@ -374,7 +374,7 @@ exports.reporter = async (page, report, _, withItems) => {
374
374
  what: `Tab responds nonstandardly to ${item.navigationErrors.join(', ')}`,
375
375
  ordinalSeverity: 1,
376
376
  count: 1,
377
- catalogIndex: getXPathCatalogIndex(report.catalog, item.xPath)
377
+ catalogIndex: getXPathCatalogIndex(report, item.xPath)
378
378
  });
379
379
  });
380
380
  }
@@ -142,7 +142,7 @@ exports.reporter = async (page, report, _, withItems) => {
142
142
  }, withItems);
143
143
  // Convert the XPaths of the proto-instances to catalog indexes.
144
144
  protoResult.standardInstances = protoResult.standardInstances.map(instance => {
145
- instance.catalogIndex = getXPathCatalogIndex(report.catalog, instance.xPath);
145
+ instance.catalogIndex = getXPathCatalogIndex(report, instance.xPath);
146
146
  delete instance.xPath;
147
147
  return instance;
148
148
  });
@@ -38,6 +38,6 @@ exports.reporter = async (page, report, _, withItems) => {
38
38
  const selector = 'body i, body b, body small';
39
39
  const whats = 'Semantically vague elements i, b, and/or small are used';
40
40
  return await doTest(
41
- page, report.catalog, withItems, 'textSem', selector, whats, 0, getBadWhat.toString()
41
+ page, report, withItems, 'textSem', selector, whats, 0, getBadWhat.toString()
42
42
  );
43
43
  };
@@ -29,6 +29,6 @@ exports.reporter = async (page, report, _, withItems) => {
29
29
  const selector = 'body [title]:not(iframe, link, style)';
30
30
  const whats = 'title attributes are used on elements they are likely ineffective on';
31
31
  return await doTest(
32
- page, report.catalog, withItems, 'titledEl', selector, whats, 0, getBadWhat.toString()
32
+ page, report, withItems, 'titledEl', selector, whats, 0, getBadWhat.toString()
33
33
  );
34
34
  };
package/testaro/zIndex.js CHANGED
@@ -33,6 +33,6 @@ exports.reporter = async (page, report, _, withItems) => {
33
33
  };
34
34
  const whats = 'Elements have non-default Z indexes';
35
35
  return await doTest(
36
- page, report.catalog, withItems, 'zIndex', 'body, body *', whats, 0, getBadWhat.toString()
36
+ page, report, withItems, 'zIndex', 'body, body *', whats, 0, getBadWhat.toString()
37
37
  );
38
38
  };
package/tests/alfa.js CHANGED
@@ -71,7 +71,6 @@ exports.reporter = async (page, report, actIndex) => {
71
71
  // Get the evaluations.
72
72
  const evaluations = Array.from(await audit.evaluate());
73
73
  const {nativeResult, standardResult} = result;
74
- const {catalog} = report;
75
74
  // For each of them:
76
75
  for (const index in evaluations) {
77
76
  const evaluation = evaluations[index];
@@ -139,7 +138,7 @@ exports.reporter = async (page, report, actIndex) => {
139
138
  what,
140
139
  ordinalSeverity,
141
140
  count: 1,
142
- catalogIndex: getXPathCatalogIndex(catalog, xPath)
141
+ catalogIndex: getXPathCatalogIndex(report, xPath)
143
142
  });
144
143
  }
145
144
  }
package/tests/aslint.js CHANGED
@@ -224,7 +224,6 @@ exports.reporter = async (page, report, actIndex) => {
224
224
  }
225
225
  // If standard results are to be reported:
226
226
  if (standard) {
227
- const {catalog} = report;
228
227
  const ruleIDs = Object.keys(rules);
229
228
  // For each violated rule:
230
229
  for (let ruleID of ruleIDs) {
@@ -249,7 +248,7 @@ exports.reporter = async (page, report, actIndex) => {
249
248
  const {xpath} = element;
250
249
  const pathID = getNormalizedXPath(xpath);
251
250
  // Use it to get the index of the element in the catalog.
252
- const catalogIndex = getXPathCatalogIndex(catalog, pathID);
251
+ const catalogIndex = getXPathCatalogIndex(report, pathID);
253
252
  // Add an instance to the standard result.
254
253
  standardResult.instances.push({
255
254
  ruleID,
package/tests/axe.js CHANGED
@@ -203,7 +203,7 @@ exports.reporter = async (page, report, actIndex) => {
203
203
  what: Array.from(whatSet.values()).join('; '),
204
204
  ordinalSeverity,
205
205
  count: 1,
206
- catalogIndex: getXPathCatalogIndex(report.catalog, xPath)
206
+ catalogIndex: getXPathCatalogIndex(report, xPath)
207
207
  };
208
208
  standardResult.instances.push(instance);
209
209
  });
package/tests/ed11y.js CHANGED
@@ -109,7 +109,7 @@ exports.reporter = async (page, report, actIndex) => {
109
109
  instance.what = content;
110
110
  instance.ordinalSeverity = dismissalKey ? 0 : 2;
111
111
  instance.count = 1;
112
- instance.catalogIndex = getXPathCatalogIndex(report.catalog, xPath);
112
+ instance.catalogIndex = getXPathCatalogIndex(report, xPath);
113
113
  standardResult.instances.push(instance);
114
114
  });
115
115
  }
package/tests/htmlcs.js CHANGED
@@ -134,7 +134,7 @@ exports.reporter = async (page, report, actIndex) => {
134
134
  what: parts[4],
135
135
  ordinalSeverity: parts[0] === 'Warning' ? 0 : 2,
136
136
  count: 1,
137
- catalogIndex: getXPathCatalogIndex(report.catalog, xPath)
137
+ catalogIndex: getXPathCatalogIndex(report, xPath)
138
138
  };
139
139
  standardResult.instances.push(instance);
140
140
  }
package/tests/ibm.js CHANGED
@@ -174,7 +174,7 @@ exports.reporter = async (page, report, actIndex) => {
174
174
  // If the XPath was obtained:
175
175
  if (xPath) {
176
176
  // Add the catalog index to the standard instance.
177
- standardItem.catalogIndex = getXPathCatalogIndex(report.catalog, xPath);
177
+ standardItem.catalogIndex = getXPathCatalogIndex(report, xPath);
178
178
  }
179
179
  // Add the standard instance to the standard result.
180
180
  standardResult.instances.push(standardItem);
package/tests/nuVal.js CHANGED
@@ -111,7 +111,7 @@ exports.reporter = async (page, report, actIndex) => {
111
111
  // If the acquisition succeeded:
112
112
  if (xPath) {
113
113
  // Add the catalog index to the standard instance.
114
- standardInstance.catalogIndex = getXPathCatalogIndex(report.catalog, xPath);
114
+ standardInstance.catalogIndex = getXPathCatalogIndex(report, xPath);
115
115
  }
116
116
  // Add the standard instance to the standard result.
117
117
  standardResult.instances.push(standardInstance);
package/tests/nuVnu.js CHANGED
@@ -99,7 +99,7 @@ exports.reporter = async (page, report, actIndex) => {
99
99
  // If the acquisition succeeded:
100
100
  if (xPath) {
101
101
  // Add the catalog index to the standard instance.
102
- standardInstance.catalogIndex = getXPathCatalogIndex(report.catalog, xPath);
102
+ standardInstance.catalogIndex = getXPathCatalogIndex(report, xPath);
103
103
  }
104
104
  // Add the standard instance to the standard result.
105
105
  standardResult.instances.push(standardInstance);
package/tests/qualWeb.js CHANGED
@@ -236,7 +236,7 @@ exports.reporter = async (page, report, actIndex, timeLimit) => {
236
236
  what,
237
237
  ordinalSeverity: ordinalSeverities[section][verdict],
238
238
  count: 1,
239
- catalogIndex: getXPathCatalogIndex(report.catalog, xPath)
239
+ catalogIndex: getXPathCatalogIndex(report, xPath)
240
240
  };
241
241
  // Add the instance to the standard result.
242
242
  standardResult.instances.push(instance);
package/tests/wave.js CHANGED
@@ -161,7 +161,7 @@ exports.reporter = async (page, report, actIndex) => {
161
161
  };
162
162
  const xPath = violation[1];
163
163
  // Add the catalog index to the instance.
164
- instance.catalogIndex = getXPathCatalogIndex(report.catalog, xPath);
164
+ instance.catalogIndex = getXPathCatalogIndex(report, xPath);
165
165
  // Add the instance to the standard result.
166
166
  instances.push(instance);
167
167
  }