testaro 60.0.0 → 60.1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "60.0.0",
3
+ "version": "60.1.0",
4
4
  "description": "Run 1000 web accessibility tests from 11 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -69,12 +69,20 @@ const linksByType = async page => await page.evaluateHandle(() => {
69
69
  }
70
70
  };
71
71
  // FUNCTION DEFINITIONS END
72
- // Identify the list links in the page.
72
+ // Identify the lists in the page.
73
73
  const lists = Array.from(document.body.querySelectorAll('ul, ol'));
74
+ // Initialize an array of list links.
74
75
  const listLinks = [];
76
+ // For each one:
75
77
  lists.forEach(list => {
78
+ // If it is a list of links:
76
79
  if (isLinkList(list)) {
77
- listLinks.push(... Array.from(list.querySelectorAll('a')));
80
+ // Choose one of the links randomly, assuming they have uniform styles.
81
+ const links = Array.from(list.querySelectorAll('a'));
82
+ const randomIndex = Math.floor(Math.random() * links.length);
83
+ const randomLink = links[randomIndex];
84
+ // Add it to the array.
85
+ listLinks.push(randomLink);
78
86
  }
79
87
  });
80
88
  // Identify the inline links in the page.
@@ -163,6 +171,7 @@ exports.reporter = async (page, withItems) => {
163
171
  // Add its elements to the object.
164
172
  elements.headings[tagName] = Array.from(body.getElementsByTagName(tagName));
165
173
  });
174
+ // FUNCTION DEFINITION START
166
175
  // Tabulates the distribution of style properties for elements of a type.
167
176
  const tallyStyles = (typeName, elements, typeStyles, withItems) => {
168
177
  // If there are any elements:
@@ -226,6 +235,7 @@ exports.reporter = async (page, withItems) => {
226
235
  }
227
236
  }
228
237
  };
238
+ // FUNCTION DEFINITION END
229
239
  // Report the style-property distributions for the element types.
230
240
  tallyStyles('button', elements.buttons, buttonStyles, withItems);
231
241
  tallyStyles('adjacentLink', elements.links.adjacent, [], withItems);