testaro 5.12.0 → 5.12.1

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/commands.js CHANGED
@@ -285,7 +285,7 @@ exports.commands = {
285
285
  'Perform a textNodes test',
286
286
  {
287
287
  detailLevel: [true, 'number', '', '0 to 3, to specify the level of detail'],
288
- text: [false, 'string', 'hasLength', 'case-insensiteve substring of the text node']
288
+ text: [false, 'string', 'hasLength', 'case-insensitive substring of the text node']
289
289
  }
290
290
  ],
291
291
  titledEl: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "5.12.0",
3
+ "version": "5.12.1",
4
4
  "description": "Automation of accessibility testing",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -26,37 +26,47 @@ exports.reporter = async (page, detailLevel, text) => {
26
26
  const data = {
27
27
  tagName: element.tagName
28
28
  };
29
- if (withText) {
30
- data.text = element.textContent;
31
- }
32
- // Add data on its attributes, if any, to the data.
33
- const {attributes} = element;
34
- if (attributes) {
35
- data.attributes = [];
36
- for (const attribute of attributes) {
37
- const {name, value} = attribute;
38
- data.attributes.push({
39
- name,
40
- value
41
- });
42
- // If any attribute is a labeler reference:
43
- if (name === 'aria-labelledby') {
44
- // Add the label texts to the data.
45
- const labelerIDs = value.split(/\s+/);
46
- data.refLabels = [];
47
- labelerIDs.forEach(id => {
48
- const labeler = document.getElementById(id);
49
- if (labeler) {
50
- data.refLabels.push(compact(labeler.textContent));
51
- }
29
+ if (! ['SCRIPT', 'SVG', 'svg'].includes(element.tagName)) {
30
+ if (withText) {
31
+ data.text = element.textContent;
32
+ }
33
+ // Add data on its attributes, if any, to the data.
34
+ const {attributes} = element;
35
+ if (attributes) {
36
+ data.attributes = [];
37
+ for (const attribute of attributes) {
38
+ const {name, value} = attribute;
39
+ data.attributes.push({
40
+ name,
41
+ value
52
42
  });
43
+ // If any attribute is a labeler reference:
44
+ if (name === 'aria-labelledby') {
45
+ // Add the label texts to the data.
46
+ const labelerIDs = value.split(/\s+/);
47
+ data.refLabels = [];
48
+ labelerIDs.forEach(id => {
49
+ const labeler = document.getElementById(id);
50
+ if (labeler) {
51
+ data.refLabels.push(compact(labeler.textContent));
52
+ }
53
+ });
54
+ }
53
55
  }
54
56
  }
55
- }
56
- // Add data on its labels, if any, to the data.
57
- const {labels} = element;
58
- if (labels) {
59
- data.labels = Array.from(labels).map(label => compact(label.textContent));
57
+ // Add data on its labels, if any, to the data.
58
+ const {labels} = element;
59
+ if (labels && labels.length) {
60
+ data.labels = Array.from(labels).map(label => compact(label.textContent));
61
+ }
62
+ // Add data on its child elements, if any, to the data.
63
+ if (element.childElementCount) {
64
+ const children = Array.from(element.children);
65
+ data.children = [];
66
+ children.forEach(child => {
67
+ data.children.push(getElementData(child, true));
68
+ });
69
+ }
60
70
  }
61
71
  return data;
62
72
  };