aria-ease 5.0.0 → 5.0.2

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.
@@ -1,4 +1,4 @@
1
- import "./chunk-2P3A4VVY.js";
1
+ import "./chunk-I2KLQ2HA.js";
2
2
 
3
3
  // src/utils/audit/src/audit/audit.ts
4
4
  import AxeBuilder from "@axe-core/playwright";
@@ -1,12 +1,7 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __commonJS = (cb, mod) => function __require() {
8
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
9
- };
10
5
  var __export = (target, all) => {
11
6
  for (var name in all)
12
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -20,18 +15,8 @@ var __copyProps = (to, from, except, desc) => {
20
15
  return to;
21
16
  };
22
17
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
- // If the importer is in node compatibility mode or this is not an ESM
25
- // file that has been converted to a CommonJS file using a Babel-
26
- // compatible transform (i.e. "__esModule" has not been set), then set
27
- // "default" to the CommonJS "module.exports" for node compatibility.
28
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
- mod
30
- ));
31
18
 
32
19
  export {
33
- __commonJS,
34
20
  __export,
35
- __reExport,
36
- __toESM
21
+ __reExport
37
22
  };
@@ -19,17 +19,22 @@ var ContractReporter = class {
19
19
  dynamicResults = [];
20
20
  totalTests = 0;
21
21
  skipped = 0;
22
+ optionalSuggestions = 0;
22
23
  isPlaywright = false;
24
+ apgUrl = "https://www.w3.org/WAI/ARIA/apg/";
23
25
  constructor(isPlaywright = false) {
24
26
  this.isPlaywright = isPlaywright;
25
27
  }
26
28
  log(message) {
27
29
  process.stderr.write(message + "\n");
28
30
  }
29
- start(componentName, totalTests) {
31
+ start(componentName, totalTests, apgUrl) {
30
32
  this.startTime = Date.now();
31
33
  this.componentName = componentName;
32
34
  this.totalTests = totalTests;
35
+ if (apgUrl) {
36
+ this.apgUrl = apgUrl;
37
+ }
33
38
  const mode = this.isPlaywright ? "Playwright (Real Browser)" : "jsdom (Fast)";
34
39
  this.log(`
35
40
  ${"\u2550".repeat(60)}`);
@@ -42,10 +47,21 @@ ${"\u2550".repeat(60)}`);
42
47
  this.staticFailures = failures;
43
48
  const icon = failures === 0 ? "\u2705" : "\u274C";
44
49
  const status = failures === 0 ? "PASS" : "FAIL";
50
+ this.log("");
45
51
  this.log(`${icon} Static ARIA Tests: ${status}`);
46
52
  this.log(` ${passes}/${passes + failures} required attributes present
47
53
  `);
48
54
  }
55
+ /**
56
+ * Report individual static test pass
57
+ */
58
+ reportStaticTest(description, passed, failureMessage) {
59
+ const icon = passed ? "\u2713" : "\u2717";
60
+ this.log(` ${icon} ${description}`);
61
+ if (!passed && failureMessage) {
62
+ this.log(` \u21B3 ${failureMessage}`);
63
+ }
64
+ }
49
65
  /**
50
66
  * Report individual dynamic test result
51
67
  */
@@ -53,20 +69,25 @@ ${"\u2550".repeat(60)}`);
53
69
  const result = {
54
70
  description: test.description,
55
71
  status,
56
- failureMessage
72
+ failureMessage,
73
+ isOptional: test.isOptional
57
74
  };
58
75
  if (status === "skip" && test.requiresBrowser) {
59
76
  result.skipReason = "Requires real browser (addEventListener events)";
60
77
  }
61
78
  this.dynamicResults.push(result);
62
- const icons = { pass: "\u2713", fail: "\u2717", skip: "\u25CB" };
63
- this.log(` ${icons[status]} ${test.description}`);
79
+ const icons = { pass: "\u2713", fail: "\u2717", skip: "\u25CB", "optional-fail": "\u25CB" };
80
+ const prefix = test.isOptional ? "[OPTIONAL] " : "";
81
+ this.log(` ${icons[status]} ${prefix}${test.description}`);
64
82
  if (status === "skip" && !this.isPlaywright) {
65
83
  this.log(` \u21B3 Skipped in jsdom (runs in Playwright)`);
66
84
  }
67
- if (status === "fail" && failureMessage) {
85
+ if (status === "fail" && failureMessage && !test.isOptional) {
68
86
  this.log(` \u21B3 ${failureMessage}`);
69
87
  }
88
+ if (status === "optional-fail") {
89
+ this.log(` \u21B3 Not implemented (recommended for enhanced UX)`);
90
+ }
70
91
  }
71
92
  /**
72
93
  * Report all failures with actionable context
@@ -89,6 +110,30 @@ ${"\u2500".repeat(60)}`);
89
110
  this.log("");
90
111
  });
91
112
  }
113
+ /**
114
+ * Report optional features that aren't implemented
115
+ */
116
+ reportOptionalSuggestions() {
117
+ const suggestions = this.dynamicResults.filter((r) => r.status === "optional-fail");
118
+ if (suggestions.length === 0) return;
119
+ this.log(`
120
+ ${"\u2500".repeat(60)}`);
121
+ this.log(`\u{1F4A1} Optional Enhancements (${suggestions.length}):
122
+ `);
123
+ this.log(`These features are optional per APG guidelines but recommended`);
124
+ this.log(`for improved user experience and keyboard navigation:
125
+ `);
126
+ suggestions.forEach((test, index) => {
127
+ this.log(`${index + 1}. ${test.description}`);
128
+ if (test.failureMessage) {
129
+ this.log(` \u21B3 ${test.failureMessage}`);
130
+ }
131
+ });
132
+ this.log(`
133
+ \u2728 Consider implementing these for better accessibility`);
134
+ this.log(` Reference: ${this.apgUrl}
135
+ `);
136
+ }
92
137
  /**
93
138
  * Report skipped tests with helpful context
94
139
  */
@@ -118,30 +163,40 @@ ${"\u2500".repeat(60)}`);
118
163
  const dynamicPasses = this.dynamicResults.filter((r) => r.status === "pass").length;
119
164
  const dynamicFailures = this.dynamicResults.filter((r) => r.status === "fail").length;
120
165
  this.skipped = this.dynamicResults.filter((r) => r.status === "skip").length;
166
+ this.optionalSuggestions = this.dynamicResults.filter((r) => r.status === "optional-fail").length;
121
167
  const totalPasses = this.staticPasses + dynamicPasses;
122
168
  const totalFailures = this.staticFailures + dynamicFailures;
123
169
  const totalRun = totalPasses + totalFailures;
124
170
  if (failures.length > 0) {
125
171
  this.reportFailures(failures);
126
172
  }
173
+ this.reportOptionalSuggestions();
127
174
  this.reportSkipped();
128
175
  this.log(`
129
176
  ${"\u2550".repeat(60)}`);
130
177
  this.log(`\u{1F4CA} Summary
131
178
  `);
132
- if (totalFailures === 0 && this.skipped === 0) {
179
+ if (totalFailures === 0 && this.skipped === 0 && this.optionalSuggestions === 0) {
133
180
  this.log(`\u2705 All ${totalRun} tests passed!`);
134
181
  this.log(` ${this.componentName} component meets APG and WCAG guidelines \u2713`);
135
182
  } else if (totalFailures === 0) {
136
- this.log(`\u2705 ${totalPasses}/${totalRun} tests passed`);
137
- this.log(`\u25CB ${this.skipped} tests skipped (jsdom limitation)`);
138
- this.log(` ${this.componentName} component works correctly`);
183
+ this.log(`\u2705 ${totalPasses}/${totalRun} required tests passed`);
184
+ if (this.skipped > 0) {
185
+ this.log(`\u25CB ${this.skipped} tests skipped (jsdom limitation)`);
186
+ }
187
+ if (this.optionalSuggestions > 0) {
188
+ this.log(`\u{1F4A1} ${this.optionalSuggestions} optional enhancement${this.optionalSuggestions > 1 ? "s" : ""} suggested`);
189
+ }
190
+ this.log(` ${this.componentName} component meets required standards \u2713`);
139
191
  } else {
140
192
  this.log(`\u274C ${totalFailures} test${totalFailures > 1 ? "s" : ""} failed`);
141
193
  this.log(`\u2705 ${totalPasses} test${totalPasses > 1 ? "s" : ""} passed`);
142
194
  if (this.skipped > 0) {
143
195
  this.log(`\u25CB ${this.skipped} test${this.skipped > 1 ? "s" : ""} skipped`);
144
196
  }
197
+ if (this.optionalSuggestions > 0) {
198
+ this.log(`\u{1F4A1} ${this.optionalSuggestions} optional enhancement${this.optionalSuggestions > 1 ? "s" : ""} suggested`);
199
+ }
145
200
  }
146
201
  this.log(`\u23F1\uFE0F Duration: ${duration}ms`);
147
202
  this.log(`${"\u2550".repeat(60)}