aria-ease 6.4.8 → 6.5.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.
Files changed (44) hide show
  1. package/README.md +15 -27
  2. package/bin/{chunk-TQBS54MM.js → chunk-AUJAN4RK.js} +35 -19
  3. package/bin/cli.cjs +952 -513
  4. package/bin/cli.js +1 -1
  5. package/bin/contractTestRunnerPlaywright-7F756CFB.js +984 -0
  6. package/bin/{test-WICJJ62P.js → test-C3CMRHSI.js} +39 -32
  7. package/dist/{chunk-TQBS54MM.js → chunk-AUJAN4RK.js} +35 -19
  8. package/dist/contractTestRunnerPlaywright-7F756CFB.js +984 -0
  9. package/dist/index.cjs +958 -519
  10. package/dist/index.js +46 -39
  11. package/dist/src/{Types.d-DYfYR3Vc.d.cts → Types.d-yGC2bBaB.d.cts} +1 -1
  12. package/dist/src/{Types.d-DYfYR3Vc.d.ts → Types.d-yGC2bBaB.d.ts} +1 -1
  13. package/dist/src/accordion/index.d.cts +1 -1
  14. package/dist/src/accordion/index.d.ts +1 -1
  15. package/dist/src/block/index.d.cts +1 -1
  16. package/dist/src/block/index.d.ts +1 -1
  17. package/dist/src/checkbox/index.d.cts +1 -1
  18. package/dist/src/checkbox/index.d.ts +1 -1
  19. package/dist/src/combobox/index.d.cts +1 -1
  20. package/dist/src/combobox/index.d.ts +1 -1
  21. package/dist/src/menu/index.cjs +7 -7
  22. package/dist/src/menu/index.d.cts +1 -1
  23. package/dist/src/menu/index.d.ts +1 -1
  24. package/dist/src/menu/index.js +7 -7
  25. package/dist/src/radio/index.d.cts +1 -1
  26. package/dist/src/radio/index.d.ts +1 -1
  27. package/dist/src/tabs/index.d.cts +1 -1
  28. package/dist/src/tabs/index.d.ts +1 -1
  29. package/dist/src/toggle/index.d.cts +1 -1
  30. package/dist/src/toggle/index.d.ts +1 -1
  31. package/dist/src/utils/test/{contracts/AccordionContract.json → aria-contracts/accordion/accordion.contract.json} +20 -7
  32. package/dist/src/utils/test/{contracts/ComboboxContract.json → aria-contracts/combobox/combobox.listbox.contract.json} +18 -17
  33. package/dist/src/utils/test/{contracts/MenuContract.json → aria-contracts/menu/menu.contract.json} +42 -1
  34. package/dist/src/utils/test/{contracts/TabsContract.json → aria-contracts/tabs/tabs.contract.json} +20 -7
  35. package/dist/src/utils/test/{chunk-TQBS54MM.js → chunk-AUJAN4RK.js} +34 -18
  36. package/dist/src/utils/test/contractTestRunnerPlaywright-HL73FADJ.js +955 -0
  37. package/dist/src/utils/test/index.cjs +921 -505
  38. package/dist/src/utils/test/index.d.cts +6 -1
  39. package/dist/src/utils/test/index.d.ts +6 -1
  40. package/dist/src/utils/test/index.js +38 -31
  41. package/package.json +2 -2
  42. package/bin/contractTestRunnerPlaywright-D57V4RSU.js +0 -628
  43. package/dist/contractTestRunnerPlaywright-D57V4RSU.js +0 -628
  44. package/dist/src/utils/test/contractTestRunnerPlaywright-HV4EIRDH.js +0 -610
@@ -2,13 +2,13 @@ import {
2
2
  ContractReporter,
3
3
  closeSharedBrowser,
4
4
  contract_default
5
- } from "./chunk-TQBS54MM.js";
5
+ } from "./chunk-AUJAN4RK.js";
6
6
  import "./chunk-I2KLQ2HA.js";
7
7
 
8
8
  // src/utils/test/src/test.ts
9
9
  import { axe } from "jest-axe";
10
10
 
11
- // src/utils/test/contract/contractTestRunner.ts
11
+ // src/utils/test/src/contractTestRunner.ts
12
12
  import fs from "fs/promises";
13
13
  async function runContractTests(componentName, component) {
14
14
  const reporter = new ContractReporter(false);
@@ -25,6 +25,7 @@ async function runContractTests(componentName, component) {
25
25
  const failures = [];
26
26
  const passes = [];
27
27
  const skipped = [];
28
+ const failuresBeforeStatic = failures.length;
28
29
  for (const test of componentContract.static[0].assertions) {
29
30
  if (test.target !== "relative") {
30
31
  const selector = componentContract.selectors[test.target];
@@ -63,8 +64,9 @@ async function runContractTests(componentName, component) {
63
64
  skipped.push(dynamicTest.description);
64
65
  reporter.reportTest(dynamicTest, "skip");
65
66
  }
66
- const staticPassed = componentContract.static[0].assertions.length;
67
- const staticFailed = 0;
67
+ const staticTotal = componentContract.static[0].assertions.length;
68
+ const staticFailed = failures.length - failuresBeforeStatic;
69
+ const staticPassed = Math.max(0, staticTotal - staticFailed);
68
70
  reporter.reportStatic(staticPassed, staticFailed);
69
71
  reporter.summary(failures);
70
72
  return { passes, failures, skipped };
@@ -114,7 +116,7 @@ Error: ${error instanceof Error ? error.message : String(error)}`
114
116
  const devServerUrl = await checkDevServer(url);
115
117
  if (devServerUrl) {
116
118
  console.log(`\u{1F3AD} Running Playwright tests on ${devServerUrl}`);
117
- const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-D57V4RSU.js");
119
+ const { runContractTestsPlaywright } = await import("./contractTestRunnerPlaywright-7F756CFB.js");
118
120
  contract = await runContractTestsPlaywright(componentName, devServerUrl);
119
121
  } else {
120
122
  throw new Error(
@@ -169,6 +171,11 @@ ${violationDetails}
169
171
  return result;
170
172
  }
171
173
  var runTest = async () => {
174
+ return {
175
+ passes: [],
176
+ failures: [],
177
+ skipped: []
178
+ };
172
179
  };
173
180
  if (typeof window === "undefined") {
174
181
  runTest = async () => {
@@ -176,36 +183,36 @@ if (typeof window === "undefined") {
176
183
  `);
177
184
  const { exec } = await import("child_process");
178
185
  const chalk = (await import("chalk")).default;
179
- exec(
180
- `npx vitest --run --reporter verbose`,
181
- { cwd: process.cwd() },
182
- async (error, stdout, stderr) => {
183
- if (stdout) {
186
+ return new Promise((resolve, reject) => {
187
+ exec(
188
+ `npx vitest --run --reporter verbose`,
189
+ async (error, stdout, stderr) => {
184
190
  console.log(stdout);
185
- }
186
- if (stderr) {
187
- console.error(stderr);
188
- }
189
- if (!error || error.code === 0) {
190
- try {
191
- const { displayBadgeInfo, promptAddBadge } = await import("./badgeHelper-JOWO6RQG.js");
192
- displayBadgeInfo("component");
193
- await promptAddBadge("component", process.cwd());
194
- console.log(chalk.dim("\n" + "\u2500".repeat(60)));
195
- console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
196
- console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
197
- console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
198
- console.log(chalk.dim("\u2500".repeat(60) + "\n"));
199
- } catch (badgeError) {
200
- console.error("Warning: Could not display badge prompt:", badgeError);
191
+ if (stderr) console.error(stderr);
192
+ const testsPassed = !error || error.code === 0;
193
+ if (testsPassed) {
194
+ try {
195
+ const { displayBadgeInfo, promptAddBadge } = await import("./badgeHelper-JOWO6RQG.js");
196
+ displayBadgeInfo("component");
197
+ await promptAddBadge("component", process.cwd());
198
+ console.log(chalk.dim("\n" + "\u2500".repeat(60)));
199
+ console.log(chalk.cyan("\u{1F499} Found aria-ease helpful?"));
200
+ console.log(chalk.white(" \u2022 Star us on GitHub: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease"));
201
+ console.log(chalk.white(" \u2022 Share feedback: ") + chalk.blue.underline("https://github.com/aria-ease/aria-ease/discussions"));
202
+ console.log(chalk.dim("\u2500".repeat(60) + "\n"));
203
+ } catch (badgeError) {
204
+ console.error("Warning: Could not display badge prompt:", badgeError);
205
+ }
206
+ resolve({ passes: [], failures: [], skipped: [] });
207
+ process.exit(0);
208
+ } else {
209
+ const exitCode = error?.code || 1;
210
+ reject(new Error(`Tests failed with code ${exitCode}`));
211
+ process.exit(exitCode);
201
212
  }
202
- process.exit(0);
203
- } else {
204
- const exitCode = error?.code || 1;
205
- process.exit(exitCode);
206
213
  }
207
- }
208
- );
214
+ );
215
+ });
209
216
  };
210
217
  }
211
218
  async function cleanupTests() {
@@ -1,24 +1,24 @@
1
1
  // src/utils/test/contract/contract.json
2
2
  var contract_default = {
3
3
  menu: {
4
- path: "./contracts/MenuContract.json",
4
+ path: "./aria-contracts/menu/menu.contract.json",
5
5
  component: "menu"
6
6
  },
7
- combobox: {
8
- path: "./contracts/ComboboxContract.json",
9
- component: "combobox"
7
+ "combobox.listbox": {
8
+ path: "./aria-contracts/combobox/combobox.listbox.contract.json",
9
+ component: "combobox.listbox"
10
10
  },
11
11
  accordion: {
12
- path: "./contracts/AccordionContract.json",
12
+ path: "./aria-contracts/accordion/accordion.contract.json",
13
13
  component: "accordion"
14
14
  },
15
15
  tabs: {
16
- path: "./contracts/TabsContract.json",
16
+ path: "./aria-contracts/tabs/tabs.contract.json",
17
17
  component: "tabs"
18
18
  }
19
19
  };
20
20
 
21
- // src/utils/test/contract/ContractReporter.ts
21
+ // src/utils/test/src/ContractReporter.ts
22
22
  var ContractReporter = class {
23
23
  startTime = 0;
24
24
  componentName = "";
@@ -30,6 +30,8 @@ var ContractReporter = class {
30
30
  optionalSuggestions = 0;
31
31
  isPlaywright = false;
32
32
  apgUrl = "https://www.w3.org/WAI/ARIA/apg/";
33
+ hasPrintedStaticSection = false;
34
+ hasPrintedDynamicSection = false;
33
35
  constructor(isPlaywright = false) {
34
36
  this.isPlaywright = isPlaywright;
35
37
  }
@@ -40,30 +42,32 @@ var ContractReporter = class {
40
42
  this.startTime = Date.now();
41
43
  this.componentName = componentName;
42
44
  this.totalTests = totalTests;
45
+ this.hasPrintedStaticSection = false;
46
+ this.hasPrintedDynamicSection = false;
43
47
  if (apgUrl) {
44
48
  this.apgUrl = apgUrl;
45
49
  }
46
50
  const mode = this.isPlaywright ? "Playwright (Real Browser)" : "jsdom (Fast)";
47
51
  this.log(`
48
52
  ${"\u2550".repeat(60)}`);
49
- this.log(`\u{1F50D} Testing ${componentName} Component - ${mode}`);
53
+ this.log(`\u{1F50D} Testing ${componentName.charAt(0).toUpperCase() + componentName.slice(1)} Component - ${mode}`);
50
54
  this.log(`${"\u2550".repeat(60)}
51
55
  `);
52
56
  }
53
57
  reportStatic(passes, failures) {
54
58
  this.staticPasses = passes;
55
59
  this.staticFailures = failures;
56
- const icon = failures === 0 ? "\u2705" : "\u274C";
57
- const status = failures === 0 ? "PASS" : "FAIL";
58
- this.log("");
59
- this.log(`${icon} Static ARIA Tests: ${status}`);
60
- this.log(` ${passes}/${passes + failures} required attributes present
61
- `);
62
60
  }
63
61
  /**
64
62
  * Report individual static test pass
65
63
  */
66
64
  reportStaticTest(description, passed, failureMessage) {
65
+ if (!this.hasPrintedStaticSection) {
66
+ this.log(`${"\u2500".repeat(60)}`);
67
+ this.log(`\u{1F9EA} Static Assertions`);
68
+ this.log(`${"\u2500".repeat(60)}`);
69
+ this.hasPrintedStaticSection = true;
70
+ }
67
71
  const icon = passed ? "\u2713" : "\u2717";
68
72
  this.log(` ${icon} ${description}`);
69
73
  if (!passed && failureMessage) {
@@ -74,13 +78,20 @@ ${"\u2550".repeat(60)}`);
74
78
  * Report individual dynamic test result
75
79
  */
76
80
  reportTest(test, status, failureMessage) {
81
+ if (!this.hasPrintedDynamicSection) {
82
+ this.log("");
83
+ this.log(`${"\u2500".repeat(60)}`);
84
+ this.log(`\u2328\uFE0F Dynamic Interaction Tests`);
85
+ this.log(`${"\u2500".repeat(60)}`);
86
+ this.hasPrintedDynamicSection = true;
87
+ }
77
88
  const result = {
78
89
  description: test.description,
79
90
  status,
80
91
  failureMessage,
81
92
  isOptional: test.isOptional
82
93
  };
83
- if (status === "skip" && test.requiresBrowser) {
94
+ if (status === "skip") {
84
95
  result.skipReason = "Requires real browser (addEventListener events)";
85
96
  }
86
97
  this.dynamicResults.push(result);
@@ -160,7 +171,7 @@ ${"\u2500".repeat(60)}`);
160
171
  });
161
172
  this.log(`
162
173
  \u{1F4A1} Run with Playwright for full validation:`);
163
- this.log(` testUiComponent('${this.componentName}', component, 'http://localhost:5173/')
174
+ this.log(` testUiComponent('${this.componentName}', null, 'http://localhost:5173/test-harness?component=component_name')
164
175
  `);
165
176
  }
166
177
  /**
@@ -184,9 +195,14 @@ ${"\u2500".repeat(60)}`);
184
195
  ${"\u2550".repeat(60)}`);
185
196
  this.log(`\u{1F4CA} Summary
186
197
  `);
198
+ const staticIcon = this.staticFailures === 0 ? "\u2705" : "\u274C";
199
+ const staticStatus = this.staticFailures === 0 ? "PASS" : "FAIL";
200
+ this.log(`${staticIcon} Static ARIA Tests: ${staticStatus}`);
201
+ this.log(` ${this.staticPasses}/${this.staticPasses + this.staticFailures} required attributes present`);
202
+ this.log("");
187
203
  if (totalFailures === 0 && this.skipped === 0 && this.optionalSuggestions === 0) {
188
204
  this.log(`\u2705 All ${totalRun} tests passed!`);
189
- this.log(` ${this.componentName} component meets WAI-ARIA expectations for Roles, States, Properties, and Keyboard Interaction \u2713`);
205
+ this.log(` ${this.componentName.charAt(0).toUpperCase()}${this.componentName.slice(1)} component meets WAI-ARIA expectations for Roles, States, Properties, and Keyboard Interactions \u2713`);
190
206
  } else if (totalFailures === 0) {
191
207
  this.log(`\u2705 ${totalPasses}/${totalRun} required tests passed`);
192
208
  if (this.skipped > 0) {
@@ -195,7 +211,7 @@ ${"\u2550".repeat(60)}`);
195
211
  if (this.optionalSuggestions > 0) {
196
212
  this.log(`\u{1F4A1} ${this.optionalSuggestions} optional enhancement${this.optionalSuggestions > 1 ? "s" : ""} suggested`);
197
213
  }
198
- this.log(` ${this.componentName} component meets WAI-ARIA expectations for Roles, States, Properties, and Keyboard Interaction \u2713`);
214
+ this.log(` ${this.componentName.charAt(0).toUpperCase()}${this.componentName.slice(1)} component meets WAI-ARIA expectations for Roles, States, Properties, and Keyboard Interactions \u2713`);
199
215
  } else {
200
216
  this.log(`\u274C ${totalFailures} test${totalFailures > 1 ? "s" : ""} failed`);
201
217
  this.log(`\u2705 ${totalPasses} test${totalPasses > 1 ? "s" : ""} passed`);
@@ -239,7 +255,7 @@ ${"\u2550".repeat(60)}`);
239
255
  }
240
256
  };
241
257
 
242
- // src/utils/test/contract/playwrightTestHarness.ts
258
+ // src/utils/test/src/playwrightTestHarness.ts
243
259
  import { chromium } from "playwright";
244
260
  var sharedBrowser = null;
245
261
  var sharedContext = null;