testaro 4.7.2 → 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.2",
3
+ "version": "4.8.0",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
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.
@@ -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
  }
@@ -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>