testaro 60.10.3 → 60.12.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/testaro/focOp.js DELETED
@@ -1,75 +0,0 @@
1
- /*
2
- © 2021–2024 CVS Health and/or one of its affiliates. All rights reserved.
3
- © 2025 Jonathan Robert Pool. All rights reserved.
4
-
5
- MIT License
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
24
- */
25
-
26
- /*
27
- focOp
28
- Related to Tenon rule 190.
29
-
30
- This test reports Tab-focusable elements that are not operable. The standard practice is to make
31
- focusable elements operable. If focusable elements are not operable, users are likely to be
32
- surprised that nothing happens when they try to operate such elements. The test considers an
33
- element operable if it has a non-inherited pointer cursor and is not a 'LABEL' element, has an
34
- operable tag name, has an interactive explicit role, or has an 'onclick' attribute. The test
35
- considers an element Tab-focusable if its tabIndex property has the value 0.
36
- */
37
-
38
- // ########## IMPORTS
39
-
40
- // Module to perform common operations.
41
- const {init, getRuleResult} = require('../procs/testaro');
42
- // Module to get operabilities.
43
- const {isOperable} = require('../procs/operable');
44
-
45
- // ########## FUNCTIONS
46
-
47
- // Runs the test and returns the result.
48
- exports.reporter = async (page, withItems) => {
49
- // Initialize the locators and result.
50
- const all = await init(100, page, 'body *');
51
- all.result.data.focusableCount = 0;
52
- // For each locator:
53
- for (const loc of all.allLocs) {
54
- // Get whether its element is focusable.
55
- const isFocusable = await loc.evaluate(el => el.tabIndex === 0);
56
- // If it is:
57
- if (isFocusable) {
58
- // Add this to the report.
59
- all.result.data.focusableCount++;
60
- // Get whether it is operable.
61
- const howOperable = await isOperable(loc);
62
- // If it is not:
63
- if (! howOperable.length) {
64
- // Add the locator to the array of violators.
65
- all.locs.push(loc);
66
- }
67
- }
68
- }
69
- // Populate and return the result.
70
- const whats = [
71
- 'Element is Tab-focusable but not operable', 'Elements are Tab-focusable but not operable'
72
- ];
73
- const result = await getRuleResult(withItems, all, 'focOp', whats, 2);
74
- return result;
75
- };
package/testaro/opFoc.js DELETED
@@ -1,76 +0,0 @@
1
- /*
2
- © 2023–2024 CVS Health and/or one of its affiliates. All rights reserved.
3
- © 2025 Jonathan Robert Pool. All rights reserved.
4
-
5
- MIT License
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in all
15
- copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- SOFTWARE.
24
- */
25
-
26
- /*
27
- opFoc
28
- Related to Tenon rule 190.
29
-
30
- This test reports operable elements that are not Tab-focusable. The standard practice is to make
31
- operable elements focusable. If operable elements are not focusable, users who navigate with a
32
- keyboard are prevented from operating those elements. The test considers an element operable if
33
- it has a non-inherited pointer cursor and is not a 'LABEL' element, has an operable tag name, has
34
- an interactive explicit role, or has an 'onclick' attribute. The test considers an element
35
- Tab-focusable if its tabIndex property has the value 0.
36
- */
37
-
38
- // ########## IMPORTS
39
-
40
- // Module to perform common operations.
41
- const {init, getRuleResult} = require('../procs/testaro');
42
- // Module to get operabilities.
43
- const {isOperable} = require('../procs/operable');
44
-
45
- // ########## FUNCTIONS
46
-
47
- // Runs the test and returns the result.
48
- exports.reporter = async (page, withItems) => {
49
- // Initialize the locators and result.
50
- const all = await init(100, page, 'body *');
51
- all.result.data.operableCount = 0;
52
- // For each locator:
53
- for (const loc of all.allLocs) {
54
- // Get whether and, if so, how its element is operable.
55
- const operabilities = await isOperable(loc);
56
- // If it is:
57
- if (operabilities.length) {
58
- // Add this to the report.
59
- all.result.data.operableCount++;
60
- // Get whether it is focusable.
61
- const isFocusable = await loc.evaluate(el => el.tabIndex === 0);
62
- // If it is not:
63
- if (! isFocusable) {
64
- // Add the locator to the array of violators.
65
- all.locs.push([loc, operabilities.join(', ')]);
66
- }
67
- }
68
- }
69
- // Populate and return the result.
70
- const whats = [
71
- 'Element is operable (__param__) but not Tab-focusable',
72
- 'Elements are operable but not Tab-focusable'
73
- ];
74
- const result = await getRuleResult(withItems, all, 'opFoc', whats, 3);
75
- return result;
76
- };