@piwitests/reporter 0.38.0 → 0.40.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.
@@ -477,9 +477,15 @@ function generateAlternatives(attrs) {
477
477
  }
478
478
  function approximateAccessibleName(attrs) {
479
479
  const a = attrs.attributes;
480
+ const labelText = attrs.labelText || null;
481
+ if (a["aria-labelledby"] && labelText) return labelText;
480
482
  const ariaLabel = a["aria-label"];
481
483
  if (ariaLabel) return ariaLabel;
482
- if (attrs.textContent) return attrs.textContent;
484
+ if (["input", "select", "textarea"].includes(attrs.tagName)) {
485
+ if (labelText) return labelText;
486
+ } else if (attrs.textContent) {
487
+ return attrs.textContent;
488
+ }
483
489
  const title = a["title"];
484
490
  if (title) return title;
485
491
  const placeholder = a["placeholder"];
@@ -1274,9 +1274,15 @@ function generateAlternatives(attrs) {
1274
1274
  }
1275
1275
  function approximateAccessibleName(attrs) {
1276
1276
  const a = attrs.attributes;
1277
+ const labelText = attrs.labelText || null;
1278
+ if (a["aria-labelledby"] && labelText) return labelText;
1277
1279
  const ariaLabel = a["aria-label"];
1278
1280
  if (ariaLabel) return ariaLabel;
1279
- if (attrs.textContent) return attrs.textContent;
1281
+ if (["input", "select", "textarea"].includes(attrs.tagName)) {
1282
+ if (labelText) return labelText;
1283
+ } else if (attrs.textContent) {
1284
+ return attrs.textContent;
1285
+ }
1280
1286
  const title = a["title"];
1281
1287
  if (title) return title;
1282
1288
  const placeholder = a["placeholder"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@piwitests/reporter",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "description": "Playwright reporter that streams results, traces and HTML reports to a Piwi Dashboard instance",
5
5
  "url": "https://github.com/PiwiTests/platform",
6
6
  "homepage": "https://piwitests.dev",