testaro 55.2.0 → 55.3.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/README.md CHANGED
@@ -73,10 +73,10 @@ Editoria11y: 23
73
73
  HTML CodeSniffer: 110
74
74
  Nu Html Checker: 260
75
75
  QualWeb: 115
76
- Testaro: 46
76
+ Testaro: 47
77
77
  WallyAX: 27
78
78
  WAVE: 60
79
- total: 1006
79
+ total: 1007
80
80
  ```
81
81
 
82
82
  Some of the tools are under active development, and their rule counts change over time.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "55.2.0",
3
+ "version": "55.3.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": {
@@ -1,5 +1,5 @@
1
1
  /*
2
- © 2023 CVS Health and/or one of its affiliates. All rights reserved.
2
+ © 2023–2025 CVS Health and/or one of its affiliates. All rights reserved.
3
3
 
4
4
  MIT License
5
5
 
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  /*
26
- targetSize
26
+ targetSmall
27
27
  Related to Tenon rule 152, but stricter.
28
28
  This test reports buttons, inputs, and non-inline links with widths or heights smaller than 44 pixels.
29
29
  */
@@ -69,5 +69,5 @@ exports.reporter = async (page, withItems) => {
69
69
  'Interactive element pixel size (__param__) is less than 44 by 44',
70
70
  'Interactive elements are smaller than 44 pixels wide and high'
71
71
  ];
72
- return await report(withItems, all, 'targetSize', whats, 1);
72
+ return await report(withItems, all, 'targetSmall', whats, 1);
73
73
  };
@@ -0,0 +1,73 @@
1
+ /*
2
+ © 2023–2025 CVS Health and/or one of its affiliates. All rights reserved.
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+ */
24
+
25
+ /*
26
+ targetTiny
27
+ Related to Tenon rule 152.
28
+ This test reports buttons, inputs, and non-inline links with widths or heights smaller than 24 pixels.
29
+ */
30
+
31
+ // ########## IMPORTS
32
+
33
+ // Module to perform common operations.
34
+ const {init, report} = require('../procs/testaro');
35
+ // Module to classify links.
36
+ const {isInlineLink} = require('../procs/isInlineLink');
37
+
38
+ // ########## FUNCTIONS
39
+
40
+ // Runs the test and returns the result.
41
+ exports.reporter = async (page, withItems) => {
42
+ // Initialize the locators and result.
43
+ const all = await init(100, page, 'a, button, input');
44
+ // For each locator:
45
+ for (const loc of all.allLocs) {
46
+ // Get the size of its element, if small.
47
+ const sizeData = await loc.evaluate(el => {
48
+ const width = el.offsetWidth;
49
+ const height = el.offsetHeight;
50
+ const tagName = el.tagName;
51
+ return width < 24 || height < 24 ? {tagName, width, height} : null;
52
+ });
53
+ // If it is small:
54
+ if (sizeData) {
55
+ // Get whether it violates the rule.
56
+ let isBad = true;
57
+ if (sizeData.tagName === 'A') {
58
+ isBad = await isInlineLink(loc);
59
+ }
60
+ // If it does:
61
+ if (isBad) {
62
+ // Add the locator to the array of violators.
63
+ all.locs.push([loc, `${sizeData.width} wide by ${sizeData.height} high`]);
64
+ }
65
+ }
66
+ }
67
+ // Populate and return the result.
68
+ const whats = [
69
+ 'Interactive element pixel size (__param__) is less than 24 by 24',
70
+ 'Interactive elements are smaller than 24 pixels wide and high'
71
+ ];
72
+ return await report(withItems, all, 'targetTiny', whats, 1);
73
+ };