testaro 29.0.0 → 29.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/data/template.js CHANGED
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
13
13
  // Runs the test and returns the result.
14
14
  exports.reporter = async (page, withItems) => {
15
15
  // Initialize the locators and result.
16
- const all = await init(page, 'body a');
16
+ const all = await init(100, page, 'body a');
17
17
  // For each locator:
18
18
  for (const loc of all.allLocs) {
19
19
  // Get whether its element violates the rule.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "29.0.0",
3
+ "version": "29.1.0",
4
4
  "description": "Run 960 web accessibility tests from 9 tools and get a standardized report",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/procs/testaro.js CHANGED
@@ -7,14 +7,10 @@ const {getSample} = require('../procs/sample');
7
7
  // Module to get locator data.
8
8
  const {getLocatorData} = require('../procs/getLocatorData');
9
9
 
10
- // ########## CONSTANTS
11
-
12
- const sampleMax = 100;
13
-
14
10
  // ########## FUNCTIONS
15
11
 
16
12
  // Initializes locators and a result.
17
- const init = async (page, locAllSelector, options = {}) => {
13
+ const init = async (sampleMax, page, locAllSelector, options = {}) => {
18
14
  // Get locators for the specified elements.
19
15
  const locPop = page.locator(locAllSelector, options);
20
16
  const locPops = await locPop.all();
@@ -98,7 +94,7 @@ const simplify = async (page, withItems, ruleData) => {
98
94
  ruleID, selector, pruner, isDestructive, complaints, ordinalSeverity, summaryTagName
99
95
  } = ruleData;
100
96
  // Initialize the locators and result.
101
- const all = await init(page, selector);
97
+ const all = await init(100, page, selector);
102
98
  // For each locator:
103
99
  for (const loc of all.allLocs) {
104
100
  // Get whether its element violates the rule.
package/testaro/attVal.js CHANGED
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
13
13
  // Runs the test and returns the result.
14
14
  exports.reporter = async (page, withItems, attributeName, areLicit, values) => {
15
15
  // Initialize the locators and result.
16
- const all = await init(page, `[${attributeName}]`);
16
+ const all = await init(100, page, `[${attributeName}]`);
17
17
  // For each locator:
18
18
  for (const loc of all.allLocs) {
19
19
  // Get whether its element violates the rule.
@@ -21,7 +21,7 @@ exports.reporter = async (
21
21
  emailLabels = ['email']
22
22
  ) => {
23
23
  // Initialize the locators and result.
24
- const all = await init(page, 'input[type=text], input[type=email], input:not([type])');
24
+ const all = await init(100, page, 'input[type=text], input[type=email], input:not([type])');
25
25
  // For each locator:
26
26
  const autoValues = {
27
27
  'given-name': givenLabels,
package/testaro/embAc.js CHANGED
@@ -17,7 +17,9 @@ const {init, report} = require('../procs/testaro');
17
17
  exports.reporter = async (page, withItems) => {
18
18
  // Initialize the locators and result.
19
19
  const all = await init(
20
- page, 'a a, a button, a input, a select, button a, button button, button input, button select'
20
+ 100,
21
+ page,
22
+ 'a a, a button, a input, a select, button a, button button, button input, button select'
21
23
  );
22
24
  // For each locator:
23
25
  for (const loc of all.allLocs) {
package/testaro/focInd.js CHANGED
@@ -27,7 +27,7 @@ const {init, report} = require('../procs/testaro');
27
27
  // Runs the test and returns the result.
28
28
  exports.reporter = async (page, withItems) => {
29
29
  // Initialize the locators and result.
30
- const all = await init(page, 'body *:visible');
30
+ const all = await init(100, page, 'body *:visible');
31
31
  all.result.data.focusableCount = 0;
32
32
  // For each locator:
33
33
  for (const loc of all.allLocs) {
package/testaro/focOp.js CHANGED
@@ -22,7 +22,7 @@ const {isOperable} = require('../procs/operable');
22
22
  // Runs the test and returns the result.
23
23
  exports.reporter = async (page, withItems) => {
24
24
  // Initialize the locators and result.
25
- const all = await init(page, 'body *');
25
+ const all = await init(100, page, 'body *');
26
26
  all.result.data.focusableCount = 0;
27
27
  // For each locator:
28
28
  for (const loc of all.allLocs) {
package/testaro/focVis.js CHANGED
@@ -14,7 +14,7 @@ const {init, report} = require('../procs/testaro');
14
14
  // Runs the test and returns the result.
15
15
  exports.reporter = async (page, withItems) => {
16
16
  // Initialize the locators and result.
17
- const all = await init(page, 'a:visible');
17
+ const all = await init(100, page, 'a:visible');
18
18
  // For each locator:
19
19
  for (const loc of all.allLocs) {
20
20
  // Get how its element violates the rule, if it does.
package/testaro/hover.js CHANGED
@@ -19,9 +19,10 @@ const {init, report} = require('../procs/testaro');
19
19
  exports.reporter = async (page, withItems) => {
20
20
  // Initialize the locators and result.
21
21
  const allTrigger = await init(
22
- page, '[aria-controls], [aria-expanded], [aria-haspopup], [onmouseenter], [onmouseover]'
22
+ 20, page, '[aria-controls], [aria-expanded], [aria-haspopup], [onmouseenter], [onmouseover]'
23
23
  );
24
24
  const allNonTrigger = await init(
25
+ 30 - allTrigger.result.data.sampleSize,
25
26
  page,
26
27
  'body *:not([aria-controls], [aria-expanded], [aria-haspopup], [onmouseenter], [onmouseover])'
27
28
  );
@@ -64,8 +65,7 @@ exports.reporter = async (page, withItems) => {
64
65
  all.locs.push([loc, impact]);
65
66
  }
66
67
  }
67
- catch(error) {
68
- }
68
+ catch(error) {}
69
69
  }
70
70
  // Populate and return the result.
71
71
  const whats = [
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
13
13
  // Runs the test and returns the result.
14
14
  exports.reporter = async (page, withItems) => {
15
15
  // Initialize the locators and result.
16
- const all = await init(page, 'button, input:not([type=hidden]), select, textarea');
16
+ const all = await init(100, page, 'button, input:not([type=hidden]), select, textarea');
17
17
  // For each locator:
18
18
  for (const loc of all.allLocs) {
19
19
  // Get the label types of its element.
@@ -15,7 +15,7 @@ const {init, report} = require('../procs/testaro');
15
15
  // Runs the test and returns the result.
16
16
  exports.reporter = async (page, withItems) => {
17
17
  // Initialize the locators and result.
18
- const all = await init(page, 'body *', {hasText: /[^\s]/});
18
+ const all = await init(100, page, 'body *', {hasText: /[^\s]/});
19
19
  // For each locator:
20
20
  for (const loc of all.allLocs) {
21
21
  // Get whether its element violates the rule.
@@ -15,7 +15,7 @@ const {getLocatorData} = require('../procs/getLocatorData');
15
15
  // Runs the test and returns the result.
16
16
  exports.reporter = async (page, withItems) => {
17
17
  // Initialize the locators and result.
18
- const all = await init(page, 'a[href]:visible');
18
+ const all = await init(100, page, 'a[href]:visible');
19
19
  const linkTexts = new Set();
20
20
  // For each locator:
21
21
  for (const loc of all.allLocs) {
@@ -13,7 +13,7 @@ const {init, report} = require('../procs/testaro');
13
13
  // Runs the test and returns the result.
14
14
  exports.reporter = async (page, withItems) => {
15
15
  // Initialize the locators and result.
16
- const all = await init(page, 'body *:not(script, style):visible', {hasText: /[^\s]+/});
16
+ const all = await init(100, page, 'body *:not(script, style):visible', {hasText: /[^\s]+/});
17
17
  // For each locator:
18
18
  for (const loc of all.allLocs) {
19
19
  // Get the font size of its element if less than 11 pixels.
package/testaro/opFoc.js CHANGED
@@ -22,7 +22,7 @@ const {isOperable} = require('../procs/operable');
22
22
  // Runs the test and returns the result.
23
23
  exports.reporter = async (page, withItems) => {
24
24
  // Initialize the locators and result.
25
- const all = await init(page, 'body *');
25
+ const all = await init(100, page, 'body *');
26
26
  all.result.data.operableCount = 0;
27
27
  // For each locator:
28
28
  for (const loc of all.allLocs) {
@@ -15,7 +15,7 @@ const {init, report} = require('../procs/testaro');
15
15
  // Runs the test and returns the result.
16
16
  exports.reporter = async (page, withItems) => {
17
17
  // Initialize the locators and result.
18
- const all = await init(page, 'body br + br');
18
+ const all = await init(100, page, 'body br + br');
19
19
  // For each locator:
20
20
  for (const loc of all.allLocs) {
21
21
  // Return whether the second br element violates the rule.
@@ -15,7 +15,7 @@ const {init, report} = require('../procs/testaro');
15
15
  // Runs the test and returns the result.
16
16
  exports.reporter = async (page, withItems) => {
17
17
  // Initialize the locators and result.
18
- const all = await init(page, 'input[type=radio]');
18
+ const all = await init(100, page, 'input[type=radio]');
19
19
  const params = {
20
20
  nameLeak: 'shares a name with others outside its field set',
21
21
  fsMixed: 'shares a field set with others having different names',
@@ -16,7 +16,7 @@ const {isInlineLink} = require('../procs/isInlineLink');
16
16
  // Runs the test and returns the result.
17
17
  exports.reporter = async (page, withItems) => {
18
18
  // Initialize the locators and result.
19
- const all = await init(page, 'a, button, input');
19
+ const all = await init(100, page, 'a, button, input');
20
20
  // For each locator:
21
21
  for (const loc of all.allLocs) {
22
22
  // Get the size of its element, if small.
package/testaro/zIndex.js CHANGED
@@ -18,7 +18,7 @@ const {init, report} = require('../procs/testaro');
18
18
  // Runs the test and returns the result.
19
19
  exports.reporter = async (page, withItems) => {
20
20
  // Initialize the locators and result.
21
- const all = await init(page, 'body *');
21
+ const all = await init(100, page, 'body *');
22
22
  // For each locator:
23
23
  for (const loc of all.allLocs) {
24
24
  // Get whether its element violates the rule.
package/tests/testaro.js CHANGED
@@ -88,7 +88,7 @@ const jsonTest = async (ruleID, ruleArgs) => {
88
88
  const ruleJSON = await fs.readFile(`${__dirname}/../testaro/${ruleID}.json`, 'utf8');
89
89
  const ruleObj = JSON.parse(ruleJSON);
90
90
  // Initialize the locators and result.
91
- const all = await init(page, ruleObj.selector);
91
+ const all = await init(100, page, ruleObj.selector);
92
92
  all.locs = all.allLocs;
93
93
  // Populate and return the result.
94
94
  const whats = [