testaro 4.7.0 → 4.8.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": "4.7.0",
3
+ "version": "4.8.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/tests/focInd.js CHANGED
@@ -121,20 +121,20 @@ exports.reporter = async (page, revealAll, allowedDelay, withItems) => {
121
121
  }
122
122
  }
123
123
  }
124
- // If no outline was allowed:
124
+ // If no allowed outline appeared:
125
125
  if (! hasOutline) {
126
126
  // Returns whether a style property differs between focused and not focused.
127
127
  const diff = prop => styleDec[prop] !== styleBlurred[prop];
128
128
  // Determine whether the element has another allowed focus indicator.
129
+ const hasDiffOutline = styleDec.outlineWidth !== '0px'
130
+ && styleDec.outlineColor !== 'rgba(0, 0, 0, 0)'
131
+ && (diff('outlineStyle') || diff('outlineWidth'));
132
+ const hasDiffBorder = styleDec.borderWidth !== '0px'
133
+ && styleDec.borderColor !== 'rgba(0, 0, 0, 0)'
134
+ && (diff('borderStyle') || diff('borderWidth'));
129
135
  const hasIndicator
130
- = diff('borderStyle')
131
- && styleBlurred.borderWidth !== '0px'
132
- && styleDec.borderWidth !== '0px'
133
- || (styleDec.borderStyle !== 'none' && diff('borderWidth'))
134
- || diff('outlineStyle')
135
- && styleBlurred.outlineWidth !== '0px'
136
- && styleDec.outlineWidth !== '0px'
137
- || (styleDec.outlineStyle !== 'none' && diff('outlineWidth'))
136
+ = hasDiffOutline
137
+ || hasDiffBorder
138
138
  || diff('fontSize')
139
139
  || diff('fontStyle')
140
140
  || diff('textDecorationLine')
package/tests/labClash.js CHANGED
@@ -71,33 +71,32 @@ exports.reporter = async (page, withItems) => {
71
71
  }
72
72
  }
73
73
  }
74
- // Content label if details required.
75
- if (withItems) {
76
- // Of button.
77
- if (labelee.tagName === 'BUTTON') {
78
- const content = debloat(labelee.textContent);
79
- if (content) {
80
- texts.content = content;
81
- }
74
+ // Content label.
75
+ // Of button.
76
+ if (labelee.tagName === 'BUTTON') {
77
+ const content = debloat(labelee.textContent);
78
+ if (content) {
79
+ texts.content = content;
82
80
  }
83
- // Of submit input.
84
- else if (labelee.tagName === 'INPUT' && labelee.type === 'submit' && labelee.value) {
85
- const content = debloat(labelee.value);
86
- if (content) {
87
- texts.content = content;
88
- }
81
+ }
82
+ // Of submit input.
83
+ else if (labelee.tagName === 'INPUT' && labelee.type === 'submit' && labelee.value) {
84
+ const content = debloat(labelee.value);
85
+ if (content) {
86
+ texts.content = content;
87
+ }
88
+ }
89
+ // Of image input.
90
+ else if (labelee.tagName === 'INPUT' && labelee.type === 'image' && labelee.alt) {
91
+ const content = debloat(labelee.alt);
92
+ if (content) {
93
+ texts.content = content;
89
94
  }
90
95
  }
91
96
  const {totals} = data;
92
97
  const labelTypeCount = labelTypes.length;
93
98
  // If it is well labeled:
94
- if (
95
- labelTypeCount === 1
96
- || ! labelTypeCount && (
97
- labelee.tagName === 'BUTTON' && debloat(labelee.textContent).length
98
- || labelee.tagName === 'INPUT' && labelee.type === 'submit' && labelee.value
99
- )
100
- ) {
99
+ if (labelTypeCount === 1 || (texts.content && ! labelTypeCount)) {
101
100
  // Increment the count of well-labeled items in the report.
102
101
  totals.wellLabeled++;
103
102
  // Add data on the item to the report, if required.
@@ -15,9 +15,10 @@
15
15
  {
16
16
  "type": "test",
17
17
  "which": "focInd",
18
- "what": "focus indication",
19
- "withItems": false,
20
18
  "revealAll": false,
19
+ "allowedDelay": 0,
20
+ "withItems": false,
21
+ "what": "focus indication",
21
22
  "expect": [
22
23
  ["totals.total", "=", 4],
23
24
  ["totals.types.indicatorMissing.total", "=", 0],
@@ -36,15 +37,19 @@
36
37
  {
37
38
  "type": "test",
38
39
  "which": "focInd",
39
- "what": "focus indication",
40
- "withItems": false,
41
40
  "revealAll": false,
41
+ "allowedDelay": 150,
42
+ "withItems": true,
43
+ "what": "focus indication",
42
44
  "expect": [
43
- ["totals.total", "=", 5],
44
- ["totals.types.indicatorMissing.total", "=", 1],
45
- ["totals.types.indicatorMissing.tagNames.INPUT", "=", 1],
46
- ["totals.types.nonOutlinePresent.total", "=", 1],
45
+ ["totals.total", "=", 9],
46
+ ["totals.types.indicatorMissing.total", "=", 3],
47
+ ["totals.types.indicatorMissing.tagNames.A", "=", 1],
48
+ ["totals.types.indicatorMissing.tagNames.INPUT", "=", 2],
49
+ ["totals.types.nonOutlinePresent.total", "=", 3],
50
+ ["totals.types.nonOutlinePresent.tagNames.A", "=", 1],
47
51
  ["totals.types.nonOutlinePresent.tagNames.BUTTON", "=", 1],
52
+ ["totals.types.nonOutlinePresent.tagNames.INPUT", "=", 1],
48
53
  ["totals.types.outlinePresent.total", "=", 3],
49
54
  ["totals.types.outlinePresent.tagNames.A", "=", 1],
50
55
  ["totals.types.outlinePresent.tagNames.BUTTON", "=", 1],
@@ -20,7 +20,7 @@
20
20
  "expect": [
21
21
  ["totals.mislabeled", "=", 0],
22
22
  ["totals.unlabeled", "=", 0],
23
- ["totals.wellLabeled", "=", 6]
23
+ ["totals.wellLabeled", "=", 7]
24
24
  ]
25
25
  },
26
26
  {
@@ -35,7 +35,7 @@
35
35
  "withItems": false,
36
36
  "expect": [
37
37
  ["totals.mislabeled", "=", 3],
38
- ["totals.unlabeled", "=", 2],
38
+ ["totals.unlabeled", "=", 3],
39
39
  ["totals.wellLabeled", "=", 0]
40
40
  ]
41
41
  }
@@ -6,26 +6,61 @@
6
6
  <meta name="description" content="tester">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
8
  <style>
9
- input[type=text]:focus {
9
+ #button:focus, #checkbox:focus {
10
+ outline: 3px solid blue;
11
+ outline-offset: 2px;
12
+ }
13
+ #checkbox {
14
+ transition-property: outline;
15
+ transition-delay: 35ms;
16
+ transition-duration: 40ms;
17
+ }
18
+ #outlinedInput {
19
+ outline: 2px solid black;
20
+ }
21
+ #outlinedInput:focus {
22
+ outline: 2px solid brown;
23
+ }
24
+ #slowLink {
25
+ transition-property: border;
26
+ transition-delay: 125ms;
27
+ }
28
+ #slowLink:focus, #sluggishLink:focus {
29
+ border: 2px solid green;
10
30
  outline: none;
11
31
  }
12
- input[type=checkbox]:focus {
13
- outline: 3px blue solid;
14
- outline-offset: 2px;
32
+ #sluggishLink {
33
+ transition-property: border;
34
+ transition-delay: 525ms;
15
35
  }
16
36
  #special:focus {
17
37
  outline: none;
18
38
  text-decoration-line: underline overline;
19
- text-decoration-color: orange;
39
+ text-decoration-color: darkorange;
40
+ }
41
+ #textInput:focus {
42
+ outline: none;
43
+ }
44
+ #thickOutlineInput {
45
+ outline: 1px solid black;
46
+ }
47
+ #thickOutlineInput:focus {
48
+ outline: 4px solid black;
20
49
  }
21
50
  </style>
22
51
  </head>
23
52
  <body>
24
53
  <main>
25
54
  <h1>Page with mixed focus indication</h1>
26
- <p>This paragraph contains a link to <a href="https://en.wikipedia.org">information</a>, a <button type="button">button</button>, and a <label>text input <input type="text"></label>. The link and button exhibit default focus indicators, but the input has none.</p>
27
- <p>This paragraph contains a checkbox with an enhanced focus-indication outline. <label><input type="checkbox"> I am human</label></p>
28
- <p>This paragraph contains a button with a non-outline focus indicator. <button id="special" type="button">special button</button></p>
55
+ <p>This paragraph contains a link to <a href="https://en.wikipedia.org">English information</a>, which exhibits a default focus indicator.</p>
56
+ <p>This paragraph contains a <button id="button" type="button">button</button> with a custom outline as its focus indicator.</p>
57
+ <p>This paragraph contains a <label>text input <input id="textInput" type="text"></label> with the focus indicator suppressed.</p>
58
+ <p>This paragraph contains a <label>text input <input id="outlinedInput" type="text"></label> with a custom outline, which changes only color when the input is focused.</p>
59
+ <p>This paragraph contains a <label>text input <input id="thickOutlineInput" type="text"></label> with a custom outline, which changes only thickness when the input is focused.</p>
60
+ <p>This paragraph contains a checkbox with an enhanced focus-indication outline that finishes appearing 75 ms after the checkbox becomes focused. <label><input id="checkbox" type="checkbox"> I am a bad page.</label></p>
61
+ <p>This paragraph contains a link to <a id="slowLink" href="https://fr.wikipedia.org">French information</a> with a custom border as its only focus indicator. The border appears 125 ms after the link becomes focused.</p>
62
+ <p>This paragraph contains a link to <a id="sluggishLink" href="https://de.wikipedia.org">German information</a> with a custom border as its only focus indicator. The border appears 525 ms after the link becomes focused.</p>
63
+ <p>This paragraph contains a button with a focus indicator consisting solely of an underline and an overline. <button id="special" type="button">special button</button></p>
29
64
  </main>
30
65
  </body>
31
66
  </html>
@@ -12,6 +12,10 @@
12
12
  <p>This paragraph contains an empty <button type="button" aria-label></button> button, with no accessible name.</p>
13
13
  <p>This is another <button id="labButton" type="button" aria-labelledby="buttonLabel">button</button> with its text content overridden by both an explicit label and a reference label as a <label id="buttonLabel" for="labButton">special type of button</label>.</p>
14
14
  <p>This is an implicitly and attribute-labeled <label>checkbox input <input id="cbox" type="checkbox" aria-label="a checkbox-type input"></label>.</p>
15
+ <p style="display: flex; align-items: center;">
16
+ <span>Here is an image input without a text alternative:</span>
17
+ <input type="image" src="delete.png" width="30rem">
18
+ </p>
15
19
  <p><span id="textInputLabel">Who is your favorite actor?</span> <input type="text" aria-labelledby="textInputLabel" aria-label="your favorite actor">.</p>
16
20
  <p>What do you think? Enter your thoughts into this text area, which is unlabeled.</p>
17
21
  <p><textarea aria-label></textarea></p>
@@ -10,6 +10,10 @@
10
10
  <main>
11
11
  <h1>Page with standard labeling</h1>
12
12
  <p>This paragraph contains a <button type="button">button</button> with its text content as accessible name, another <button id="labButton" type="button">button</button> with its text content overridden by an explicit label as a <label for="labButton">special type of button</label>, an <label>implicitly labeled text input <input type="text"></label>, and an explicitly labeled <label for="cbox">checkbox input</label>: <input id="cbox" type="checkbox">.</p>
13
+ <p style="display: flex; align-items: center;">
14
+ <span>Here is an image input with a text alternative:</span>
15
+ <input type="image" src="delete.png" alt="delete" width="30rem">
16
+ </p>
13
17
  <p>This <label>implicitly labeled text input <input id="textInput" type="text"></label> also has an explicit label, which validly provides <label for="textInput">additional information</label>.</p>
14
18
  <p><span id="what">What do you think?</span> Enter your thoughts into this text area, which is labeled by reference.</p>
15
19
  <p><textarea aria-labelledby="what"></textarea></p>