testaro 60.8.3 → 60.9.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
@@ -120,8 +120,7 @@ After that, you can update Testaro after any version change:
120
120
  cd testaro
121
121
  git checkout package-lock.json
122
122
  git pull
123
- npm update
124
- npx playwright install
123
+ npm run deps
125
124
  ```
126
125
 
127
126
  Once it is installed as an application, you can use its features with a terminal interface by executing the “By a user” statements below.
@@ -0,0 +1,1087 @@
1
+ var computeAccessibleName = (() => {
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __commonJS = (cb, mod) => function __require() {
4
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
5
+ };
6
+
7
+ // node_modules/dom-accessibility-api/dist/polyfills/array.from.js
8
+ var require_array_from = __commonJS({
9
+ "node_modules/dom-accessibility-api/dist/polyfills/array.from.js"(exports) {
10
+ "use strict";
11
+ exports.__esModule = true;
12
+ exports.default = arrayFrom;
13
+ var toStr = Object.prototype.toString;
14
+ function isCallable(fn) {
15
+ return typeof fn === "function" || toStr.call(fn) === "[object Function]";
16
+ }
17
+ function toInteger(value) {
18
+ var number = Number(value);
19
+ if (isNaN(number)) {
20
+ return 0;
21
+ }
22
+ if (number === 0 || !isFinite(number)) {
23
+ return number;
24
+ }
25
+ return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
26
+ }
27
+ var maxSafeInteger = Math.pow(2, 53) - 1;
28
+ function toLength(value) {
29
+ var len = toInteger(value);
30
+ return Math.min(Math.max(len, 0), maxSafeInteger);
31
+ }
32
+ function arrayFrom(arrayLike, mapFn) {
33
+ var C = Array;
34
+ var items = Object(arrayLike);
35
+ if (arrayLike == null) {
36
+ throw new TypeError("Array.from requires an array-like object - not null or undefined");
37
+ }
38
+ if (typeof mapFn !== "undefined") {
39
+ if (!isCallable(mapFn)) {
40
+ throw new TypeError("Array.from: when provided, the second argument must be a function");
41
+ }
42
+ }
43
+ var len = toLength(items.length);
44
+ var A = isCallable(C) ? Object(new C(len)) : new Array(len);
45
+ var k = 0;
46
+ var kValue;
47
+ while (k < len) {
48
+ kValue = items[k];
49
+ if (mapFn) {
50
+ A[k] = mapFn(kValue, k);
51
+ } else {
52
+ A[k] = kValue;
53
+ }
54
+ k += 1;
55
+ }
56
+ A.length = len;
57
+ return A;
58
+ }
59
+ }
60
+ });
61
+
62
+ // node_modules/dom-accessibility-api/dist/polyfills/SetLike.js
63
+ var require_SetLike = __commonJS({
64
+ "node_modules/dom-accessibility-api/dist/polyfills/SetLike.js"(exports) {
65
+ "use strict";
66
+ exports.__esModule = true;
67
+ exports.default = void 0;
68
+ function _typeof(o) {
69
+ "@babel/helpers - typeof";
70
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
71
+ return typeof o2;
72
+ } : function(o2) {
73
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
74
+ }, _typeof(o);
75
+ }
76
+ function _classCallCheck(instance, Constructor) {
77
+ if (!(instance instanceof Constructor)) {
78
+ throw new TypeError("Cannot call a class as a function");
79
+ }
80
+ }
81
+ function _defineProperties(target, props) {
82
+ for (var i = 0; i < props.length; i++) {
83
+ var descriptor = props[i];
84
+ descriptor.enumerable = descriptor.enumerable || false;
85
+ descriptor.configurable = true;
86
+ if ("value" in descriptor) descriptor.writable = true;
87
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
88
+ }
89
+ }
90
+ function _createClass(Constructor, protoProps, staticProps) {
91
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
92
+ if (staticProps) _defineProperties(Constructor, staticProps);
93
+ Object.defineProperty(Constructor, "prototype", { writable: false });
94
+ return Constructor;
95
+ }
96
+ function _defineProperty(obj, key, value) {
97
+ key = _toPropertyKey(key);
98
+ if (key in obj) {
99
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
100
+ } else {
101
+ obj[key] = value;
102
+ }
103
+ return obj;
104
+ }
105
+ function _toPropertyKey(t) {
106
+ var i = _toPrimitive(t, "string");
107
+ return "symbol" == _typeof(i) ? i : i + "";
108
+ }
109
+ function _toPrimitive(t, r) {
110
+ if ("object" != _typeof(t) || !t) return t;
111
+ var e = t[Symbol.toPrimitive];
112
+ if (void 0 !== e) {
113
+ var i = e.call(t, r || "default");
114
+ if ("object" != _typeof(i)) return i;
115
+ throw new TypeError("@@toPrimitive must return a primitive value.");
116
+ }
117
+ return ("string" === r ? String : Number)(t);
118
+ }
119
+ var SetLike = /* @__PURE__ */ (function() {
120
+ function SetLike2() {
121
+ var items = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
122
+ _classCallCheck(this, SetLike2);
123
+ _defineProperty(this, "items", void 0);
124
+ this.items = items;
125
+ }
126
+ return _createClass(SetLike2, [{
127
+ key: "add",
128
+ value: function add(value) {
129
+ if (this.has(value) === false) {
130
+ this.items.push(value);
131
+ }
132
+ return this;
133
+ }
134
+ }, {
135
+ key: "clear",
136
+ value: function clear() {
137
+ this.items = [];
138
+ }
139
+ }, {
140
+ key: "delete",
141
+ value: function _delete(value) {
142
+ var previousLength = this.items.length;
143
+ this.items = this.items.filter(function(item) {
144
+ return item !== value;
145
+ });
146
+ return previousLength !== this.items.length;
147
+ }
148
+ }, {
149
+ key: "forEach",
150
+ value: function forEach(callbackfn) {
151
+ var _this = this;
152
+ this.items.forEach(function(item) {
153
+ callbackfn(item, item, _this);
154
+ });
155
+ }
156
+ }, {
157
+ key: "has",
158
+ value: function has(value) {
159
+ return this.items.indexOf(value) !== -1;
160
+ }
161
+ }, {
162
+ key: "size",
163
+ get: function get() {
164
+ return this.items.length;
165
+ }
166
+ }]);
167
+ })();
168
+ var _default = exports.default = typeof Set === "undefined" ? Set : SetLike;
169
+ }
170
+ });
171
+
172
+ // node_modules/dom-accessibility-api/dist/getRole.js
173
+ var require_getRole = __commonJS({
174
+ "node_modules/dom-accessibility-api/dist/getRole.js"(exports) {
175
+ "use strict";
176
+ exports.__esModule = true;
177
+ exports.default = getRole;
178
+ exports.getLocalName = getLocalName;
179
+ var _util = require_util();
180
+ function getLocalName(element) {
181
+ var _element$localName;
182
+ return (
183
+ // eslint-disable-next-line no-restricted-properties -- actual guard for environments without localName
184
+ (_element$localName = element.localName) !== null && _element$localName !== void 0 ? _element$localName : (
185
+ // eslint-disable-next-line no-restricted-properties -- required for the fallback
186
+ element.tagName.toLowerCase()
187
+ )
188
+ );
189
+ }
190
+ var localNameToRoleMappings = {
191
+ article: "article",
192
+ aside: "complementary",
193
+ button: "button",
194
+ datalist: "listbox",
195
+ dd: "definition",
196
+ details: "group",
197
+ dialog: "dialog",
198
+ dt: "term",
199
+ fieldset: "group",
200
+ figure: "figure",
201
+ // WARNING: Only with an accessible name
202
+ form: "form",
203
+ footer: "contentinfo",
204
+ h1: "heading",
205
+ h2: "heading",
206
+ h3: "heading",
207
+ h4: "heading",
208
+ h5: "heading",
209
+ h6: "heading",
210
+ header: "banner",
211
+ hr: "separator",
212
+ html: "document",
213
+ legend: "legend",
214
+ li: "listitem",
215
+ math: "math",
216
+ main: "main",
217
+ menu: "list",
218
+ nav: "navigation",
219
+ ol: "list",
220
+ optgroup: "group",
221
+ // WARNING: Only in certain context
222
+ option: "option",
223
+ output: "status",
224
+ progress: "progressbar",
225
+ // WARNING: Only with an accessible name
226
+ section: "region",
227
+ summary: "button",
228
+ table: "table",
229
+ tbody: "rowgroup",
230
+ textarea: "textbox",
231
+ tfoot: "rowgroup",
232
+ // WARNING: Only in certain context
233
+ td: "cell",
234
+ th: "columnheader",
235
+ thead: "rowgroup",
236
+ tr: "row",
237
+ ul: "list"
238
+ };
239
+ var prohibitedAttributes = {
240
+ caption: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
241
+ code: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
242
+ deletion: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
243
+ emphasis: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
244
+ generic: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby", "aria-roledescription"]),
245
+ insertion: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
246
+ none: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
247
+ paragraph: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
248
+ presentation: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
249
+ strong: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
250
+ subscript: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"]),
251
+ superscript: /* @__PURE__ */ new Set(["aria-label", "aria-labelledby"])
252
+ };
253
+ function hasGlobalAriaAttributes(element, role) {
254
+ return [
255
+ "aria-atomic",
256
+ "aria-busy",
257
+ "aria-controls",
258
+ "aria-current",
259
+ "aria-description",
260
+ "aria-describedby",
261
+ "aria-details",
262
+ // "disabled",
263
+ "aria-dropeffect",
264
+ // "errormessage",
265
+ "aria-flowto",
266
+ "aria-grabbed",
267
+ // "haspopup",
268
+ "aria-hidden",
269
+ // "invalid",
270
+ "aria-keyshortcuts",
271
+ "aria-label",
272
+ "aria-labelledby",
273
+ "aria-live",
274
+ "aria-owns",
275
+ "aria-relevant",
276
+ "aria-roledescription"
277
+ ].some(function(attributeName) {
278
+ var _prohibitedAttributes;
279
+ return element.hasAttribute(attributeName) && !((_prohibitedAttributes = prohibitedAttributes[role]) !== null && _prohibitedAttributes !== void 0 && _prohibitedAttributes.has(attributeName));
280
+ });
281
+ }
282
+ function ignorePresentationalRole(element, implicitRole) {
283
+ return hasGlobalAriaAttributes(element, implicitRole);
284
+ }
285
+ function getRole(element) {
286
+ var explicitRole = getExplicitRole(element);
287
+ if (explicitRole === null || _util.presentationRoles.indexOf(explicitRole) !== -1) {
288
+ var implicitRole = getImplicitRole(element);
289
+ if (_util.presentationRoles.indexOf(explicitRole || "") === -1 || ignorePresentationalRole(element, implicitRole || "")) {
290
+ return implicitRole;
291
+ }
292
+ }
293
+ return explicitRole;
294
+ }
295
+ function getImplicitRole(element) {
296
+ var mappedByTag = localNameToRoleMappings[getLocalName(element)];
297
+ if (mappedByTag !== void 0) {
298
+ return mappedByTag;
299
+ }
300
+ switch (getLocalName(element)) {
301
+ case "a":
302
+ case "area":
303
+ case "link":
304
+ if (element.hasAttribute("href")) {
305
+ return "link";
306
+ }
307
+ break;
308
+ case "img":
309
+ if (element.getAttribute("alt") === "" && !ignorePresentationalRole(element, "img")) {
310
+ return "presentation";
311
+ }
312
+ return "img";
313
+ case "input": {
314
+ var _ref = element, type = _ref.type;
315
+ switch (type) {
316
+ case "button":
317
+ case "image":
318
+ case "reset":
319
+ case "submit":
320
+ return "button";
321
+ case "checkbox":
322
+ case "radio":
323
+ return type;
324
+ case "range":
325
+ return "slider";
326
+ case "email":
327
+ case "tel":
328
+ case "text":
329
+ case "url":
330
+ if (element.hasAttribute("list")) {
331
+ return "combobox";
332
+ }
333
+ return "textbox";
334
+ case "search":
335
+ if (element.hasAttribute("list")) {
336
+ return "combobox";
337
+ }
338
+ return "searchbox";
339
+ case "number":
340
+ return "spinbutton";
341
+ default:
342
+ return null;
343
+ }
344
+ }
345
+ case "select":
346
+ if (element.hasAttribute("multiple") || element.size > 1) {
347
+ return "listbox";
348
+ }
349
+ return "combobox";
350
+ }
351
+ return null;
352
+ }
353
+ function getExplicitRole(element) {
354
+ var role = element.getAttribute("role");
355
+ if (role !== null) {
356
+ var explicitRole = role.trim().split(" ")[0];
357
+ if (explicitRole.length > 0) {
358
+ return explicitRole;
359
+ }
360
+ }
361
+ return null;
362
+ }
363
+ }
364
+ });
365
+
366
+ // node_modules/dom-accessibility-api/dist/util.js
367
+ var require_util = __commonJS({
368
+ "node_modules/dom-accessibility-api/dist/util.js"(exports) {
369
+ "use strict";
370
+ function _typeof(o) {
371
+ "@babel/helpers - typeof";
372
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
373
+ return typeof o2;
374
+ } : function(o2) {
375
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
376
+ }, _typeof(o);
377
+ }
378
+ exports.__esModule = true;
379
+ exports.hasAnyConcreteRoles = hasAnyConcreteRoles;
380
+ exports.isElement = isElement;
381
+ exports.isHTMLFieldSetElement = isHTMLFieldSetElement;
382
+ exports.isHTMLInputElement = isHTMLInputElement;
383
+ exports.isHTMLLegendElement = isHTMLLegendElement;
384
+ exports.isHTMLOptGroupElement = isHTMLOptGroupElement;
385
+ exports.isHTMLSelectElement = isHTMLSelectElement;
386
+ exports.isHTMLSlotElement = isHTMLSlotElement;
387
+ exports.isHTMLTableCaptionElement = isHTMLTableCaptionElement;
388
+ exports.isHTMLTableElement = isHTMLTableElement;
389
+ exports.isHTMLTextAreaElement = isHTMLTextAreaElement;
390
+ exports.isSVGElement = isSVGElement;
391
+ exports.isSVGSVGElement = isSVGSVGElement;
392
+ exports.isSVGTitleElement = isSVGTitleElement;
393
+ exports.presentationRoles = void 0;
394
+ exports.queryIdRefs = queryIdRefs;
395
+ exports.safeWindow = safeWindow;
396
+ var _getRole = _interopRequireWildcard(require_getRole());
397
+ exports.getLocalName = _getRole.getLocalName;
398
+ function _getRequireWildcardCache(e) {
399
+ if ("function" != typeof WeakMap) return null;
400
+ var r = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap();
401
+ return (_getRequireWildcardCache = function _getRequireWildcardCache2(e2) {
402
+ return e2 ? t : r;
403
+ })(e);
404
+ }
405
+ function _interopRequireWildcard(e, r) {
406
+ if (!r && e && e.__esModule) return e;
407
+ if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e };
408
+ var t = _getRequireWildcardCache(r);
409
+ if (t && t.has(e)) return t.get(e);
410
+ var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor;
411
+ for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) {
412
+ var i = a ? Object.getOwnPropertyDescriptor(e, u) : null;
413
+ i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u];
414
+ }
415
+ return n.default = e, t && t.set(e, n), n;
416
+ }
417
+ var presentationRoles = exports.presentationRoles = ["presentation", "none"];
418
+ function isElement(node) {
419
+ return node !== null && node.nodeType === node.ELEMENT_NODE;
420
+ }
421
+ function isHTMLTableCaptionElement(node) {
422
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "caption";
423
+ }
424
+ function isHTMLInputElement(node) {
425
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "input";
426
+ }
427
+ function isHTMLOptGroupElement(node) {
428
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "optgroup";
429
+ }
430
+ function isHTMLSelectElement(node) {
431
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "select";
432
+ }
433
+ function isHTMLTableElement(node) {
434
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "table";
435
+ }
436
+ function isHTMLTextAreaElement(node) {
437
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "textarea";
438
+ }
439
+ function safeWindow(node) {
440
+ var _ref = node.ownerDocument === null ? node : node.ownerDocument, defaultView = _ref.defaultView;
441
+ if (defaultView === null) {
442
+ throw new TypeError("no window available");
443
+ }
444
+ return defaultView;
445
+ }
446
+ function isHTMLFieldSetElement(node) {
447
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "fieldset";
448
+ }
449
+ function isHTMLLegendElement(node) {
450
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "legend";
451
+ }
452
+ function isHTMLSlotElement(node) {
453
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "slot";
454
+ }
455
+ function isSVGElement(node) {
456
+ return isElement(node) && node.ownerSVGElement !== void 0;
457
+ }
458
+ function isSVGSVGElement(node) {
459
+ return isElement(node) && (0, _getRole.getLocalName)(node) === "svg";
460
+ }
461
+ function isSVGTitleElement(node) {
462
+ return isSVGElement(node) && (0, _getRole.getLocalName)(node) === "title";
463
+ }
464
+ function queryIdRefs(node, attributeName) {
465
+ if (isElement(node) && node.hasAttribute(attributeName)) {
466
+ var ids = node.getAttribute(attributeName).split(" ");
467
+ var root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
468
+ return ids.map(function(id) {
469
+ return root.getElementById(id);
470
+ }).filter(
471
+ function(element) {
472
+ return element !== null;
473
+ }
474
+ // TODO: why does this not narrow?
475
+ );
476
+ }
477
+ return [];
478
+ }
479
+ function hasAnyConcreteRoles(node, roles) {
480
+ if (isElement(node)) {
481
+ return roles.indexOf((0, _getRole.default)(node)) !== -1;
482
+ }
483
+ return false;
484
+ }
485
+ }
486
+ });
487
+
488
+ // node_modules/dom-accessibility-api/dist/accessible-name-and-description.js
489
+ var require_accessible_name_and_description = __commonJS({
490
+ "node_modules/dom-accessibility-api/dist/accessible-name-and-description.js"(exports) {
491
+ "use strict";
492
+ exports.__esModule = true;
493
+ exports.computeTextAlternative = computeTextAlternative;
494
+ var _array = _interopRequireDefault(require_array_from());
495
+ var _SetLike = _interopRequireDefault(require_SetLike());
496
+ var _util = require_util();
497
+ function _interopRequireDefault(obj) {
498
+ return obj && obj.__esModule ? obj : { default: obj };
499
+ }
500
+ function asFlatString(s) {
501
+ return s.trim().replace(/\s\s+/g, " ");
502
+ }
503
+ function isHidden(node, getComputedStyleImplementation) {
504
+ if (!(0, _util.isElement)(node)) {
505
+ return false;
506
+ }
507
+ if (node.hasAttribute("hidden") || node.getAttribute("aria-hidden") === "true") {
508
+ return true;
509
+ }
510
+ var style = getComputedStyleImplementation(node);
511
+ return style.getPropertyValue("display") === "none" || style.getPropertyValue("visibility") === "hidden";
512
+ }
513
+ function isControl(node) {
514
+ return (0, _util.hasAnyConcreteRoles)(node, ["button", "combobox", "listbox", "textbox"]) || hasAbstractRole(node, "range");
515
+ }
516
+ function hasAbstractRole(node, role) {
517
+ if (!(0, _util.isElement)(node)) {
518
+ return false;
519
+ }
520
+ switch (role) {
521
+ case "range":
522
+ return (0, _util.hasAnyConcreteRoles)(node, ["meter", "progressbar", "scrollbar", "slider", "spinbutton"]);
523
+ default:
524
+ throw new TypeError("No knowledge about abstract role '".concat(role, "'. This is likely a bug :("));
525
+ }
526
+ }
527
+ function querySelectorAllSubtree(element, selectors) {
528
+ var elements = (0, _array.default)(element.querySelectorAll(selectors));
529
+ (0, _util.queryIdRefs)(element, "aria-owns").forEach(function(root) {
530
+ elements.push.apply(elements, (0, _array.default)(root.querySelectorAll(selectors)));
531
+ });
532
+ return elements;
533
+ }
534
+ function querySelectedOptions(listbox) {
535
+ if ((0, _util.isHTMLSelectElement)(listbox)) {
536
+ return listbox.selectedOptions || querySelectorAllSubtree(listbox, "[selected]");
537
+ }
538
+ return querySelectorAllSubtree(listbox, '[aria-selected="true"]');
539
+ }
540
+ function isMarkedPresentational(node) {
541
+ return (0, _util.hasAnyConcreteRoles)(node, _util.presentationRoles);
542
+ }
543
+ function isNativeHostLanguageTextAlternativeElement(node) {
544
+ return (0, _util.isHTMLTableCaptionElement)(node);
545
+ }
546
+ function allowsNameFromContent(node) {
547
+ return (0, _util.hasAnyConcreteRoles)(node, ["button", "cell", "checkbox", "columnheader", "gridcell", "heading", "label", "legend", "link", "menuitem", "menuitemcheckbox", "menuitemradio", "option", "radio", "row", "rowheader", "switch", "tab", "tooltip", "treeitem"]);
548
+ }
549
+ function isDescendantOfNativeHostLanguageTextAlternativeElement(node) {
550
+ return false;
551
+ }
552
+ function getValueOfTextbox(element) {
553
+ if ((0, _util.isHTMLInputElement)(element) || (0, _util.isHTMLTextAreaElement)(element)) {
554
+ return element.value;
555
+ }
556
+ return element.textContent || "";
557
+ }
558
+ function getTextualContent(declaration) {
559
+ var content = declaration.getPropertyValue("content");
560
+ if (/^["'].*["']$/.test(content)) {
561
+ return content.slice(1, -1);
562
+ }
563
+ return "";
564
+ }
565
+ function isLabelableElement(element) {
566
+ var localName = (0, _util.getLocalName)(element);
567
+ return localName === "button" || localName === "input" && element.getAttribute("type") !== "hidden" || localName === "meter" || localName === "output" || localName === "progress" || localName === "select" || localName === "textarea";
568
+ }
569
+ function findLabelableElement(element) {
570
+ if (isLabelableElement(element)) {
571
+ return element;
572
+ }
573
+ var labelableElement = null;
574
+ element.childNodes.forEach(function(childNode) {
575
+ if (labelableElement === null && (0, _util.isElement)(childNode)) {
576
+ var descendantLabelableElement = findLabelableElement(childNode);
577
+ if (descendantLabelableElement !== null) {
578
+ labelableElement = descendantLabelableElement;
579
+ }
580
+ }
581
+ });
582
+ return labelableElement;
583
+ }
584
+ function getControlOfLabel(label) {
585
+ if (label.control !== void 0) {
586
+ return label.control;
587
+ }
588
+ var htmlFor = label.getAttribute("for");
589
+ if (htmlFor !== null) {
590
+ return label.ownerDocument.getElementById(htmlFor);
591
+ }
592
+ return findLabelableElement(label);
593
+ }
594
+ function getLabels(element) {
595
+ var labelsProperty = element.labels;
596
+ if (labelsProperty === null) {
597
+ return labelsProperty;
598
+ }
599
+ if (labelsProperty !== void 0) {
600
+ return (0, _array.default)(labelsProperty);
601
+ }
602
+ if (!isLabelableElement(element)) {
603
+ return null;
604
+ }
605
+ var document = element.ownerDocument;
606
+ return (0, _array.default)(document.querySelectorAll("label")).filter(function(label) {
607
+ return getControlOfLabel(label) === element;
608
+ });
609
+ }
610
+ function getSlotContents(slot) {
611
+ var assignedNodes = slot.assignedNodes();
612
+ if (assignedNodes.length === 0) {
613
+ return (0, _array.default)(slot.childNodes);
614
+ }
615
+ return assignedNodes;
616
+ }
617
+ function computeTextAlternative(root) {
618
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
619
+ var consultedNodes = new _SetLike.default();
620
+ var computedStyles = typeof Map === "undefined" ? void 0 : /* @__PURE__ */ new Map();
621
+ var window2 = (0, _util.safeWindow)(root);
622
+ var _options$compute = options.compute, compute = _options$compute === void 0 ? "name" : _options$compute, _options$computedStyl = options.computedStyleSupportsPseudoElements, computedStyleSupportsPseudoElements = _options$computedStyl === void 0 ? options.getComputedStyle !== void 0 : _options$computedStyl, _options$getComputedS = options.getComputedStyle, uncachedGetComputedStyle = _options$getComputedS === void 0 ? window2.getComputedStyle.bind(window2) : _options$getComputedS, _options$hidden = options.hidden, hidden = _options$hidden === void 0 ? false : _options$hidden;
623
+ var getComputedStyle = function getComputedStyle2(el, pseudoElement) {
624
+ if (pseudoElement !== void 0) {
625
+ throw new Error("use uncachedGetComputedStyle directly for pseudo elements");
626
+ }
627
+ if (computedStyles === void 0) {
628
+ return uncachedGetComputedStyle(el);
629
+ }
630
+ var cachedStyles = computedStyles.get(el);
631
+ if (cachedStyles) {
632
+ return cachedStyles;
633
+ }
634
+ var style = uncachedGetComputedStyle(el, pseudoElement);
635
+ computedStyles.set(el, style);
636
+ return style;
637
+ };
638
+ function computeMiscTextAlternative(node, context) {
639
+ var accumulatedText = "";
640
+ if ((0, _util.isElement)(node) && computedStyleSupportsPseudoElements) {
641
+ var pseudoBefore = uncachedGetComputedStyle(node, "::before");
642
+ var beforeContent = getTextualContent(pseudoBefore);
643
+ accumulatedText = "".concat(beforeContent, " ").concat(accumulatedText);
644
+ }
645
+ var childNodes = (0, _util.isHTMLSlotElement)(node) ? getSlotContents(node) : (0, _array.default)(node.childNodes).concat((0, _util.queryIdRefs)(node, "aria-owns"));
646
+ childNodes.forEach(function(child) {
647
+ var result = computeTextAlternative2(child, {
648
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
649
+ isReferenced: false,
650
+ recursion: true
651
+ });
652
+ var display = (0, _util.isElement)(child) ? getComputedStyle(child).getPropertyValue("display") : "inline";
653
+ var separator = display !== "inline" ? " " : "";
654
+ accumulatedText += "".concat(separator).concat(result).concat(separator);
655
+ });
656
+ if ((0, _util.isElement)(node) && computedStyleSupportsPseudoElements) {
657
+ var pseudoAfter = uncachedGetComputedStyle(node, "::after");
658
+ var afterContent = getTextualContent(pseudoAfter);
659
+ accumulatedText = "".concat(accumulatedText, " ").concat(afterContent);
660
+ }
661
+ return accumulatedText.trim();
662
+ }
663
+ function useAttribute(element, attributeName) {
664
+ var attribute = element.getAttributeNode(attributeName);
665
+ if (attribute !== null && !consultedNodes.has(attribute) && attribute.value.trim() !== "") {
666
+ consultedNodes.add(attribute);
667
+ return attribute.value;
668
+ }
669
+ return null;
670
+ }
671
+ function computeTooltipAttributeValue(node) {
672
+ if (!(0, _util.isElement)(node)) {
673
+ return null;
674
+ }
675
+ return useAttribute(node, "title");
676
+ }
677
+ function computeElementTextAlternative(node) {
678
+ if (!(0, _util.isElement)(node)) {
679
+ return null;
680
+ }
681
+ if ((0, _util.isHTMLFieldSetElement)(node)) {
682
+ consultedNodes.add(node);
683
+ var children = (0, _array.default)(node.childNodes);
684
+ for (var i = 0; i < children.length; i += 1) {
685
+ var child = children[i];
686
+ if ((0, _util.isHTMLLegendElement)(child)) {
687
+ return computeTextAlternative2(child, {
688
+ isEmbeddedInLabel: false,
689
+ isReferenced: false,
690
+ recursion: false
691
+ });
692
+ }
693
+ }
694
+ } else if ((0, _util.isHTMLTableElement)(node)) {
695
+ consultedNodes.add(node);
696
+ var _children = (0, _array.default)(node.childNodes);
697
+ for (var _i = 0; _i < _children.length; _i += 1) {
698
+ var _child = _children[_i];
699
+ if ((0, _util.isHTMLTableCaptionElement)(_child)) {
700
+ return computeTextAlternative2(_child, {
701
+ isEmbeddedInLabel: false,
702
+ isReferenced: false,
703
+ recursion: false
704
+ });
705
+ }
706
+ }
707
+ } else if ((0, _util.isSVGSVGElement)(node)) {
708
+ consultedNodes.add(node);
709
+ var _children2 = (0, _array.default)(node.childNodes);
710
+ for (var _i2 = 0; _i2 < _children2.length; _i2 += 1) {
711
+ var _child2 = _children2[_i2];
712
+ if ((0, _util.isSVGTitleElement)(_child2)) {
713
+ return _child2.textContent;
714
+ }
715
+ }
716
+ return null;
717
+ } else if ((0, _util.getLocalName)(node) === "img" || (0, _util.getLocalName)(node) === "area") {
718
+ var nameFromAlt = useAttribute(node, "alt");
719
+ if (nameFromAlt !== null) {
720
+ return nameFromAlt;
721
+ }
722
+ } else if ((0, _util.isHTMLOptGroupElement)(node)) {
723
+ var nameFromLabel = useAttribute(node, "label");
724
+ if (nameFromLabel !== null) {
725
+ return nameFromLabel;
726
+ }
727
+ }
728
+ if ((0, _util.isHTMLInputElement)(node) && (node.type === "button" || node.type === "submit" || node.type === "reset")) {
729
+ var nameFromValue = useAttribute(node, "value");
730
+ if (nameFromValue !== null) {
731
+ return nameFromValue;
732
+ }
733
+ if (node.type === "submit") {
734
+ return "Submit";
735
+ }
736
+ if (node.type === "reset") {
737
+ return "Reset";
738
+ }
739
+ }
740
+ var labels = getLabels(node);
741
+ if (labels !== null && labels.length !== 0) {
742
+ consultedNodes.add(node);
743
+ return (0, _array.default)(labels).map(function(element) {
744
+ return computeTextAlternative2(element, {
745
+ isEmbeddedInLabel: true,
746
+ isReferenced: false,
747
+ recursion: true
748
+ });
749
+ }).filter(function(label) {
750
+ return label.length > 0;
751
+ }).join(" ");
752
+ }
753
+ if ((0, _util.isHTMLInputElement)(node) && node.type === "image") {
754
+ var _nameFromAlt = useAttribute(node, "alt");
755
+ if (_nameFromAlt !== null) {
756
+ return _nameFromAlt;
757
+ }
758
+ var nameFromTitle = useAttribute(node, "title");
759
+ if (nameFromTitle !== null) {
760
+ return nameFromTitle;
761
+ }
762
+ return "Submit Query";
763
+ }
764
+ if ((0, _util.hasAnyConcreteRoles)(node, ["button"])) {
765
+ var nameFromSubTree = computeMiscTextAlternative(node, {
766
+ isEmbeddedInLabel: false,
767
+ isReferenced: false
768
+ });
769
+ if (nameFromSubTree !== "") {
770
+ return nameFromSubTree;
771
+ }
772
+ }
773
+ return null;
774
+ }
775
+ function computeTextAlternative2(current, context) {
776
+ if (consultedNodes.has(current)) {
777
+ return "";
778
+ }
779
+ if (!hidden && isHidden(current, getComputedStyle) && !context.isReferenced) {
780
+ consultedNodes.add(current);
781
+ return "";
782
+ }
783
+ var labelAttributeNode = (0, _util.isElement)(current) ? current.getAttributeNode("aria-labelledby") : null;
784
+ var labelElements = labelAttributeNode !== null && !consultedNodes.has(labelAttributeNode) ? (0, _util.queryIdRefs)(current, "aria-labelledby") : [];
785
+ if (compute === "name" && !context.isReferenced && labelElements.length > 0) {
786
+ consultedNodes.add(labelAttributeNode);
787
+ return labelElements.map(function(element) {
788
+ return computeTextAlternative2(element, {
789
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
790
+ isReferenced: true,
791
+ // this isn't recursion as specified, otherwise we would skip
792
+ // `aria-label` in
793
+ // <input id="myself" aria-label="foo" aria-labelledby="myself"
794
+ recursion: false
795
+ });
796
+ }).join(" ");
797
+ }
798
+ var skipToStep2E = context.recursion && isControl(current) && compute === "name";
799
+ if (!skipToStep2E) {
800
+ var ariaLabel = ((0, _util.isElement)(current) && current.getAttribute("aria-label") || "").trim();
801
+ if (ariaLabel !== "" && compute === "name") {
802
+ consultedNodes.add(current);
803
+ return ariaLabel;
804
+ }
805
+ if (!isMarkedPresentational(current)) {
806
+ var elementTextAlternative = computeElementTextAlternative(current);
807
+ if (elementTextAlternative !== null) {
808
+ consultedNodes.add(current);
809
+ return elementTextAlternative;
810
+ }
811
+ }
812
+ }
813
+ if ((0, _util.hasAnyConcreteRoles)(current, ["menu"])) {
814
+ consultedNodes.add(current);
815
+ return "";
816
+ }
817
+ if (skipToStep2E || context.isEmbeddedInLabel || context.isReferenced) {
818
+ if ((0, _util.hasAnyConcreteRoles)(current, ["combobox", "listbox"])) {
819
+ consultedNodes.add(current);
820
+ var selectedOptions = querySelectedOptions(current);
821
+ if (selectedOptions.length === 0) {
822
+ return (0, _util.isHTMLInputElement)(current) ? current.value : "";
823
+ }
824
+ return (0, _array.default)(selectedOptions).map(function(selectedOption) {
825
+ return computeTextAlternative2(selectedOption, {
826
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
827
+ isReferenced: false,
828
+ recursion: true
829
+ });
830
+ }).join(" ");
831
+ }
832
+ if (hasAbstractRole(current, "range")) {
833
+ consultedNodes.add(current);
834
+ if (current.hasAttribute("aria-valuetext")) {
835
+ return current.getAttribute("aria-valuetext");
836
+ }
837
+ if (current.hasAttribute("aria-valuenow")) {
838
+ return current.getAttribute("aria-valuenow");
839
+ }
840
+ return current.getAttribute("value") || "";
841
+ }
842
+ if ((0, _util.hasAnyConcreteRoles)(current, ["textbox"])) {
843
+ consultedNodes.add(current);
844
+ return getValueOfTextbox(current);
845
+ }
846
+ }
847
+ if (allowsNameFromContent(current) || (0, _util.isElement)(current) && context.isReferenced || isNativeHostLanguageTextAlternativeElement(current) || isDescendantOfNativeHostLanguageTextAlternativeElement(current)) {
848
+ var accumulatedText2F = computeMiscTextAlternative(current, {
849
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
850
+ isReferenced: false
851
+ });
852
+ if (accumulatedText2F !== "") {
853
+ consultedNodes.add(current);
854
+ return accumulatedText2F;
855
+ }
856
+ }
857
+ if (current.nodeType === current.TEXT_NODE) {
858
+ consultedNodes.add(current);
859
+ return current.textContent || "";
860
+ }
861
+ if (context.recursion) {
862
+ consultedNodes.add(current);
863
+ return computeMiscTextAlternative(current, {
864
+ isEmbeddedInLabel: context.isEmbeddedInLabel,
865
+ isReferenced: false
866
+ });
867
+ }
868
+ var tooltipAttributeValue = computeTooltipAttributeValue(current);
869
+ if (tooltipAttributeValue !== null) {
870
+ consultedNodes.add(current);
871
+ return tooltipAttributeValue;
872
+ }
873
+ consultedNodes.add(current);
874
+ return "";
875
+ }
876
+ return asFlatString(computeTextAlternative2(root, {
877
+ isEmbeddedInLabel: false,
878
+ // by spec computeAccessibleDescription starts with the referenced elements as roots
879
+ isReferenced: compute === "description",
880
+ recursion: false
881
+ }));
882
+ }
883
+ }
884
+ });
885
+
886
+ // node_modules/dom-accessibility-api/dist/accessible-description.js
887
+ var require_accessible_description = __commonJS({
888
+ "node_modules/dom-accessibility-api/dist/accessible-description.js"(exports) {
889
+ "use strict";
890
+ exports.__esModule = true;
891
+ exports.computeAccessibleDescription = computeAccessibleDescription;
892
+ var _accessibleNameAndDescription = require_accessible_name_and_description();
893
+ var _util = require_util();
894
+ function _typeof(o) {
895
+ "@babel/helpers - typeof";
896
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
897
+ return typeof o2;
898
+ } : function(o2) {
899
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
900
+ }, _typeof(o);
901
+ }
902
+ function ownKeys(e, r) {
903
+ var t = Object.keys(e);
904
+ if (Object.getOwnPropertySymbols) {
905
+ var o = Object.getOwnPropertySymbols(e);
906
+ r && (o = o.filter(function(r2) {
907
+ return Object.getOwnPropertyDescriptor(e, r2).enumerable;
908
+ })), t.push.apply(t, o);
909
+ }
910
+ return t;
911
+ }
912
+ function _objectSpread(e) {
913
+ for (var r = 1; r < arguments.length; r++) {
914
+ var t = null != arguments[r] ? arguments[r] : {};
915
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
916
+ _defineProperty(e, r2, t[r2]);
917
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
918
+ Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
919
+ });
920
+ }
921
+ return e;
922
+ }
923
+ function _defineProperty(obj, key, value) {
924
+ key = _toPropertyKey(key);
925
+ if (key in obj) {
926
+ Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
927
+ } else {
928
+ obj[key] = value;
929
+ }
930
+ return obj;
931
+ }
932
+ function _toPropertyKey(t) {
933
+ var i = _toPrimitive(t, "string");
934
+ return "symbol" == _typeof(i) ? i : i + "";
935
+ }
936
+ function _toPrimitive(t, r) {
937
+ if ("object" != _typeof(t) || !t) return t;
938
+ var e = t[Symbol.toPrimitive];
939
+ if (void 0 !== e) {
940
+ var i = e.call(t, r || "default");
941
+ if ("object" != _typeof(i)) return i;
942
+ throw new TypeError("@@toPrimitive must return a primitive value.");
943
+ }
944
+ return ("string" === r ? String : Number)(t);
945
+ }
946
+ function computeAccessibleDescription(root) {
947
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
948
+ var description = (0, _util.queryIdRefs)(root, "aria-describedby").map(function(element) {
949
+ return (0, _accessibleNameAndDescription.computeTextAlternative)(element, _objectSpread(_objectSpread({}, options), {}, {
950
+ compute: "description"
951
+ }));
952
+ }).join(" ");
953
+ if (description === "") {
954
+ var ariaDescription = root.getAttribute("aria-description");
955
+ description = ariaDescription === null ? "" : ariaDescription;
956
+ }
957
+ if (description === "") {
958
+ var title = root.getAttribute("title");
959
+ description = title === null ? "" : title;
960
+ }
961
+ return description;
962
+ }
963
+ }
964
+ });
965
+
966
+ // node_modules/dom-accessibility-api/dist/accessible-name.js
967
+ var require_accessible_name = __commonJS({
968
+ "node_modules/dom-accessibility-api/dist/accessible-name.js"(exports) {
969
+ "use strict";
970
+ exports.__esModule = true;
971
+ exports.computeAccessibleName = computeAccessibleName2;
972
+ var _accessibleNameAndDescription = require_accessible_name_and_description();
973
+ var _util = require_util();
974
+ function prohibitsNaming(node) {
975
+ return (0, _util.hasAnyConcreteRoles)(node, ["caption", "code", "deletion", "emphasis", "generic", "insertion", "none", "paragraph", "presentation", "strong", "subscript", "superscript"]);
976
+ }
977
+ function computeAccessibleName2(root) {
978
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
979
+ if (prohibitsNaming(root)) {
980
+ return "";
981
+ }
982
+ return (0, _accessibleNameAndDescription.computeTextAlternative)(root, options);
983
+ }
984
+ }
985
+ });
986
+
987
+ // node_modules/dom-accessibility-api/dist/is-inaccessible.js
988
+ var require_is_inaccessible = __commonJS({
989
+ "node_modules/dom-accessibility-api/dist/is-inaccessible.js"(exports) {
990
+ "use strict";
991
+ exports.__esModule = true;
992
+ exports.isInaccessible = isInaccessible;
993
+ exports.isSubtreeInaccessible = isSubtreeInaccessible;
994
+ function isInaccessible(element) {
995
+ var _element$ownerDocumen;
996
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
997
+ var _options$getComputedS = options.getComputedStyle, getComputedStyle = _options$getComputedS === void 0 ? (_element$ownerDocumen = element.ownerDocument.defaultView) === null || _element$ownerDocumen === void 0 ? void 0 : _element$ownerDocumen.getComputedStyle : _options$getComputedS, _options$isSubtreeIna = options.isSubtreeInaccessible, isSubtreeInaccessibleImpl = _options$isSubtreeIna === void 0 ? isSubtreeInaccessible : _options$isSubtreeIna;
998
+ if (typeof getComputedStyle !== "function") {
999
+ throw new TypeError("Owner document of the element needs to have an associated window.");
1000
+ }
1001
+ if (getComputedStyle(element).visibility === "hidden") {
1002
+ return true;
1003
+ }
1004
+ var currentElement = element;
1005
+ while (currentElement) {
1006
+ if (isSubtreeInaccessibleImpl(currentElement, {
1007
+ getComputedStyle
1008
+ })) {
1009
+ return true;
1010
+ }
1011
+ currentElement = currentElement.parentElement;
1012
+ }
1013
+ return false;
1014
+ }
1015
+ function isSubtreeInaccessible(element) {
1016
+ var _element$ownerDocumen2;
1017
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1018
+ var _options$getComputedS2 = options.getComputedStyle, getComputedStyle = _options$getComputedS2 === void 0 ? (_element$ownerDocumen2 = element.ownerDocument.defaultView) === null || _element$ownerDocumen2 === void 0 ? void 0 : _element$ownerDocumen2.getComputedStyle : _options$getComputedS2;
1019
+ if (typeof getComputedStyle !== "function") {
1020
+ throw new TypeError("Owner document of the element needs to have an associated window.");
1021
+ }
1022
+ if (element.hidden === true) {
1023
+ return true;
1024
+ }
1025
+ if (element.getAttribute("aria-hidden") === "true") {
1026
+ return true;
1027
+ }
1028
+ if (getComputedStyle(element).display === "none") {
1029
+ return true;
1030
+ }
1031
+ return false;
1032
+ }
1033
+ }
1034
+ });
1035
+
1036
+ // node_modules/dom-accessibility-api/dist/is-disabled.js
1037
+ var require_is_disabled = __commonJS({
1038
+ "node_modules/dom-accessibility-api/dist/is-disabled.js"(exports) {
1039
+ "use strict";
1040
+ exports.__esModule = true;
1041
+ exports.isDisabled = isDisabled;
1042
+ var _getRole = require_getRole();
1043
+ var elementsSupportingDisabledAttribute = /* @__PURE__ */ new Set(["button", "fieldset", "input", "optgroup", "option", "select", "textarea"]);
1044
+ function isDisabled(element) {
1045
+ var localName = (0, _getRole.getLocalName)(element);
1046
+ return elementsSupportingDisabledAttribute.has(localName) && element.hasAttribute("disabled") ? true : element.getAttribute("aria-disabled") === "true";
1047
+ }
1048
+ }
1049
+ });
1050
+
1051
+ // node_modules/dom-accessibility-api/dist/index.js
1052
+ var require_dist = __commonJS({
1053
+ "node_modules/dom-accessibility-api/dist/index.js"(exports) {
1054
+ "use strict";
1055
+ exports.__esModule = true;
1056
+ var _exportNames = {
1057
+ computeAccessibleDescription: true,
1058
+ computeAccessibleName: true,
1059
+ getRole: true,
1060
+ isDisabled: true
1061
+ };
1062
+ exports.isDisabled = exports.getRole = exports.computeAccessibleName = exports.computeAccessibleDescription = void 0;
1063
+ var _accessibleDescription = require_accessible_description();
1064
+ exports.computeAccessibleDescription = _accessibleDescription.computeAccessibleDescription;
1065
+ var _accessibleName = require_accessible_name();
1066
+ exports.computeAccessibleName = _accessibleName.computeAccessibleName;
1067
+ var _getRole = _interopRequireDefault(require_getRole());
1068
+ exports.getRole = _getRole.default;
1069
+ var _isInaccessible = require_is_inaccessible();
1070
+ Object.keys(_isInaccessible).forEach(function(key) {
1071
+ if (key === "default" || key === "__esModule") return;
1072
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
1073
+ if (key in exports && exports[key] === _isInaccessible[key]) return;
1074
+ exports[key] = _isInaccessible[key];
1075
+ });
1076
+ var _isDisabled = require_is_disabled();
1077
+ exports.isDisabled = _isDisabled.isDisabled;
1078
+ function _interopRequireDefault(obj) {
1079
+ return obj && obj.__esModule ? obj : { default: obj };
1080
+ }
1081
+ }
1082
+ });
1083
+
1084
+ // src/nameComputation.js
1085
+ var { computeAccessibleName } = require_dist();
1086
+ window.computeAccessibleName = computeAccessibleName;
1087
+ })();
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "testaro",
3
- "version": "60.8.3",
3
+ "version": "60.9.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": {
7
+ "build:nameComputation": "esbuild src/nameComputation.js --bundle --format=iife --global-name=computeAccessibleName --outfile=dist/nameComputation.js",
8
+ "build": "npm run build:nameComputation",
9
+ "deps": "npm update && npx playwright install && npm run build",
7
10
  "tests": "node validation/executors/tests",
8
11
  "test": "node validation/executors/test",
9
12
  "run": "node validation/executors/run",
@@ -47,6 +50,8 @@
47
50
  "puppeteer-extra-plugin-stealth": "*"
48
51
  },
49
52
  "devDependencies": {
53
+ "dom-accessibility-api": "*",
54
+ "esbuild": "*",
50
55
  "eslint": "*"
51
56
  }
52
57
  }
package/run.js CHANGED
@@ -436,6 +436,8 @@ const launch = exports.launch = async (
436
436
  // Wait until it is stable.
437
437
  await page.waitForLoadState('domcontentloaded', {timeout: 5000});
438
438
  const isTestaroTest = act.type === 'test' && act.which === 'testaro';
439
+ // Add a script to the page to compute the accessible name of an element.
440
+ await page.addInitScript({path: require.resolve('./dist/nameComputation.js')});
439
441
  // Add a script to the page to:
440
442
  await page.addInitScript(isTestaroTest => {
441
443
  // Mask automation detection.
@@ -449,6 +451,13 @@ const launch = exports.launch = async (
449
451
  });
450
452
  // If the act is a testaro test act:
451
453
  if (isTestaroTest) {
454
+ // Add a window method to compute the accessible name of an element.
455
+ window.getAccessibleName = element => {
456
+ const nameIsComputable = element
457
+ && element.nodeType === Node.ELEMENT_NODE
458
+ && typeof window.computeAccessibleName === 'function';
459
+ return nameIsComputable ? window.computeAccessibleName(element) : '';
460
+ };
452
461
  // Add a window method to return an instance.
453
462
  window.getInstance = (
454
463
  element, ruleID, what, count = 1, ordinalSeverity, summaryTagName = ''
@@ -0,0 +1,5 @@
1
+ // src/nameComputation.js
2
+
3
+ const {computeAccessibleName} = require('dom-accessibility-api');
4
+
5
+ window.computeAccessibleName = computeAccessibleName;
package/testaro/attVal.js CHANGED
@@ -24,35 +24,44 @@
24
24
 
25
25
  /*
26
26
  attVal
27
- This test reports attributes with illicit values.
27
+ This test reports elements with illicit values of an attribute.
28
28
  */
29
29
 
30
- // ########## IMPORTS
31
-
32
- // Module to perform common operations.
33
- const {init, getRuleResult} = require('../procs/testaro');
34
-
35
- // ########## FUNCTIONS
30
+ // FUNCTIONS
36
31
 
37
32
  // Runs the test and returns the result.
38
33
  exports.reporter = async (page, withItems, attributeName, areLicit, values) => {
39
- // Initialize the locators and result.
40
- const all = await init(100, page, `[${attributeName}]`);
41
- // For each locator:
42
- for (const loc of all.allLocs) {
43
- // Get whether its element violates the rule.
44
- const value = await loc.getAttribute(attributeName);
45
- const isBad = areLicit !== values.includes(value);
46
- // If it does:
47
- if (isBad) {
48
- // Add the locator to the array of violators.
49
- all.locs.push([loc, value]);
34
+ // Return totals and standard instances for the rule.
35
+ return await page.evaluate(args => {
36
+ const [withItems, attributeName, areLicit, values] = args;
37
+ // Get all candidates, i.e. elements with the attribute.
38
+ const candidates = document.body.querySelectorAll(`[${attributeName}]`);
39
+ let violationCount = 0;
40
+ const instances = [];
41
+ // For each candidate:
42
+ candidates.forEach(element => {
43
+ const value = element.getAttribute(attributeName);
44
+ // If it violates the rule:
45
+ if (areLicit !== values.includes(value)) {
46
+ // Increment the violation count.
47
+ violationCount++;
48
+ // If itemization is required:
49
+ if (withItems) {
50
+ const what = `Element has attribute ${attributeName} with illicit value ${value}`;
51
+ instances.push(window.getInstance(element, 'attVal', what, 1, 2));
52
+ }
53
+ }
54
+ });
55
+ // If there were any violations and itemization is not required:
56
+ if (violationCount && ! withItems) {
57
+ const what = `Elements have attribute ${attributeName} with illicit values`;
58
+ // Add a summary instance to the instances.
59
+ instances.push(window.getInstance(null, 'attVal', what, violationCount, 2));
50
60
  }
51
- }
52
- // Populate and return the result.
53
- const whats = [
54
- `Element has attribute ${attributeName} with illicit value “__param__”`,
55
- `Elements have attribute ${attributeName} with illicit values`
56
- ];
57
- return await getRuleResult(withItems, all, 'attVal', whats, 2);
61
+ return {
62
+ data: {},
63
+ totals: [0, 0, violationCount, 0],
64
+ standardInstances: instances
65
+ };
66
+ }, [withItems, attributeName, areLicit, values]);
58
67
  };
@@ -1,5 +1,6 @@
1
1
  /*
2
2
  © 2023 CVS Health and/or one of its affiliates. All rights reserved.
3
+ © 2025 Jonathan Robert Pool. All rights reserved.
3
4
 
4
5
  MIT License
5
6
 
@@ -27,59 +28,74 @@
27
28
  This test reports failures to equip name and email inputs with correct autocomplete attributes.
28
29
  */
29
30
 
30
- // ########## IMPORTS
31
-
32
- // Module to perform common operations.
33
- const {init, getRuleResult} = require('../procs/testaro');
34
- // Module to get locator data.
35
- const {getLocatorData} = require('../procs/getLocatorData');
36
-
37
- // ########## FUNCTIONS
31
+ // FUNCTIONS
38
32
 
39
33
  // Runs the test and returns the result.
40
34
  exports.reporter = async (
41
35
  page,
42
36
  withItems,
37
+ nameLabels = ['your name', 'full name', 'first and last name'],
38
+ emailLabels = ['email'],
43
39
  givenLabels = ['first name', 'forename', 'given name'],
44
- familyLabels = ['last name', 'surname', 'family name'],
45
- emailLabels = ['email']
40
+ familyLabels = ['last name', 'surname', 'family name']
46
41
  ) => {
47
- // Initialize the locators and result.
48
- const all = await init(100, page, 'input[type=text], input[type=email], input:not([type])');
49
- // For each locator:
50
- const autoValues = {
51
- 'given-name': givenLabels,
52
- 'family-name': familyLabels,
53
- 'email': emailLabels
54
- };
55
- for (const loc of all.allLocs) {
56
- // Get which autocomplete value, if any, its element needs.
57
- const elData = await getLocatorData(loc);
58
- const lcText = elData.excerpt.toLowerCase();
59
- const neededAutos = Object.keys(autoValues)
60
- .filter(autoValue => autoValues[autoValue].some(typeLabel => lcText.includes(typeLabel)));
61
- let neededAuto;
62
- if (neededAutos.length === 1) {
63
- neededAuto = neededAutos[0];
64
- }
65
- else if (! neededAutos.length && await loc.getAttribute('type') === 'email') {
66
- neededAuto = 'email';
67
- }
68
- // If it needs one:
69
- if (neededAuto) {
70
- // If it does not have the one it needs:
71
- const actualAuto = await loc.getAttribute('autocomplete');
72
- const isBad = actualAuto !== neededAuto;
73
- if (isBad) {
74
- // Add the locator to the array of violators.
75
- all.locs.push([loc, neededAuto]);
42
+ // Return totals and standard instances for the rule.
43
+ return await page.evaluate(args => {
44
+ const [withItems, nameLabels,givenLabels, familyLabels, emailLabels] = args;
45
+ // Get all candidates, i.e. text and email input elements.
46
+ const candidates = document.body.querySelectorAll(
47
+ 'input[type=text], input[type=email], input:not([type])'
48
+ );
49
+ let violationCount = 0;
50
+ const instances = [];
51
+ // For each candidate:
52
+ candidates.forEach(candidate => {
53
+ // Get its lower-cased accessible name.
54
+ const name = window.getAccessibleName(candidate).toLowerCase();
55
+ // Get its required autocomplete value.
56
+ let requiredAuto = '';
57
+ if (candidate.type === 'email' || name && emailLabels.some(label => name.includes(label))) {
58
+ requiredAuto = 'email';
59
+ }
60
+ else if (
61
+ name && candidate.type === 'text' && nameLabels.some(label => name.includes(label))
62
+ ) {
63
+ requiredAuto = 'name';
76
64
  }
65
+ else if (
66
+ name && candidate.type === 'text' && givenLabels.some(label => name.includes(label))
67
+ ) {
68
+ requiredAuto = 'given-name';
69
+ }
70
+ else if (
71
+ name && candidate.type === 'text' && familyLabels.some(label => name.includes(label))
72
+ ) {
73
+ requiredAuto = 'family-name';
74
+ }
75
+ // Get its actual autocomplete value.
76
+ const actualAuto = candidate.getAttribute('autocomplete');
77
+ // If an autocomplete value is required but not present:
78
+ if (requiredAuto && ! (actualAuto && actualAuto.includes(requiredAuto))) {
79
+ // Increment the violation count.
80
+ violationCount++;
81
+ // If itemization is required:
82
+ if (withItems) {
83
+ const what = `input has no autocomplete="${requiredAuto}" attribute`;
84
+ // Add an instance to the instances.
85
+ instances.push(window.getInstance(candidate, 'autocomplete', what, 1, 2));
86
+ }
87
+ }
88
+ });
89
+ // If there were any violations and itemization is not required:
90
+ if (violationCount && ! withItems) {
91
+ const what = 'Inputs are missing required autocomplete attributes';
92
+ // Add a summary instance to the instances.
93
+ instances.push(window.getInstance(null, 'autocomplete', what, violationCount, 2));
94
+ }
95
+ return {
96
+ data: {},
97
+ totals: [0, 0, violationCount, 0],
98
+ standardInstances: instances
77
99
  }
78
- }
79
- // Populate and return the result.
80
- const whats = [
81
- 'Input is missing an autocomplete attribute with value __param__',
82
- 'Inputs are missing applicable autocomplete attributes'
83
- ];
84
- return await getRuleResult(withItems, all, 'autocomplete', whats, 2);
100
+ }, [withItems, nameLabels, givenLabels, familyLabels, emailLabels]);
85
101
  };