aria-ease 6.11.0 → 6.12.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 (28) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-XERMSYEH.js → chunk-FZ7GMIJB.js} +0 -21
  3. package/dist/{chunk-NI3MQCAS.js → chunk-GJGUY643.js} +2 -2
  4. package/dist/cli.cjs +26 -63
  5. package/dist/cli.js +3 -3
  6. package/dist/{configLoader-DWHOHXHL.js → configLoader-Q7N5XV4P.js} +2 -2
  7. package/dist/{configLoader-UJZHQBYS.js → configLoader-REHK3S3Q.js} +1 -1
  8. package/dist/{contractTestRunnerPlaywright-QDXSK3FE.js → contractTestRunnerPlaywright-DIXP5DQ3.js} +5 -20
  9. package/dist/{contractTestRunnerPlaywright-WNWQYSXZ.js → contractTestRunnerPlaywright-EWAWQVHT.js} +5 -20
  10. package/dist/index.cjs +32 -66
  11. package/dist/index.d.cts +3 -0
  12. package/dist/index.d.ts +3 -0
  13. package/dist/index.js +23 -15
  14. package/dist/src/utils/test/{chunk-XERMSYEH.js → chunk-FZ7GMIJB.js} +1 -21
  15. package/dist/src/utils/test/{configLoader-SHJSRG2A.js → configLoader-NA7IBCS3.js} +2 -2
  16. package/dist/src/utils/test/{contractTestRunnerPlaywright-Z2AHXSNM.js → contractTestRunnerPlaywright-CIZOXYRW.js} +5 -19
  17. package/dist/src/utils/test/dsl/index.cjs +7 -4
  18. package/dist/src/utils/test/dsl/index.d.cts +3 -0
  19. package/dist/src/utils/test/dsl/index.d.ts +3 -0
  20. package/dist/src/utils/test/dsl/index.js +7 -4
  21. package/dist/src/utils/test/index.cjs +19 -55
  22. package/dist/src/utils/test/index.js +16 -10
  23. package/dist/{test-O3J4ZPQR.js → test-HBPCSYH5.js} +16 -11
  24. package/package.json +2 -3
  25. package/dist/src/utils/test/aria-contracts/accordion/accordion.contract.json +0 -290
  26. package/dist/src/utils/test/aria-contracts/combobox/combobox.listbox.contract.json +0 -463
  27. package/dist/src/utils/test/aria-contracts/menu/menu.contract.json +0 -562
  28. package/dist/src/utils/test/aria-contracts/tabs/tabs.contract.json +0 -361
package/README.md CHANGED
@@ -195,7 +195,7 @@ export default {
195
195
  strictness: "balanced",
196
196
  components: [
197
197
  {
198
- name: "combobox.listbox",
198
+ name: "combobox",
199
199
  path: "./tests/external-contracts/combobox.listbox.contract.json",
200
200
  strategyPath: "./tests/external-strategies/CustomComboboxStrategy.js",
201
201
  },
@@ -1,23 +1,3 @@
1
- // src/utils/test/contract/contract.json
2
- var contract_default = {
3
- menu: {
4
- path: "./aria-contracts/menu/menu.contract.json",
5
- component: "menu"
6
- },
7
- "combobox.listbox": {
8
- path: "./aria-contracts/combobox/combobox.listbox.contract.json",
9
- component: "combobox.listbox"
10
- },
11
- accordion: {
12
- path: "./aria-contracts/accordion/accordion.contract.json",
13
- component: "accordion"
14
- },
15
- tabs: {
16
- path: "./aria-contracts/tabs/tabs.contract.json",
17
- component: "tabs"
18
- }
19
- };
20
-
21
1
  // src/utils/test/src/ContractReporter.ts
22
2
  var ContractReporter = class {
23
3
  startTime = 0;
@@ -353,7 +333,6 @@ async function closeSharedBrowser() {
353
333
  }
354
334
 
355
335
  export {
356
- contract_default,
357
336
  ContractReporter,
358
337
  normalizeLevel,
359
338
  normalizeStrictness,
@@ -68,8 +68,8 @@ function validateConfig(config) {
68
68
  if (typeof comp.name !== "string") {
69
69
  errors.push(`test.components[${idx}].name must be a string`);
70
70
  }
71
- if (comp.path !== void 0 && typeof comp.path !== "string") {
72
- errors.push(`test.components[${idx}].path must be a string when provided`);
71
+ if (comp.contractPath !== void 0 && typeof comp.contractPath !== "string") {
72
+ errors.push(`test.components[${idx}].contractPath must be a string when provided`);
73
73
  }
74
74
  if (comp.strategyPath !== void 0 && typeof comp.strategyPath !== "string") {
75
75
  errors.push(`test.components[${idx}].strategyPath must be a string when provided`);
package/dist/cli.cjs CHANGED
@@ -103,8 +103,8 @@ function validateConfig(config) {
103
103
  if (typeof comp.name !== "string") {
104
104
  errors.push(`test.components[${idx}].name must be a string`);
105
105
  }
106
- if (comp.path !== void 0 && typeof comp.path !== "string") {
107
- errors.push(`test.components[${idx}].path must be a string when provided`);
106
+ if (comp.contractPath !== void 0 && typeof comp.contractPath !== "string") {
107
+ errors.push(`test.components[${idx}].contractPath must be a string when provided`);
108
108
  }
109
109
  if (comp.strategyPath !== void 0 && typeof comp.strategyPath !== "string") {
110
110
  errors.push(`test.components[${idx}].strategyPath must be a string when provided`);
@@ -586,31 +586,6 @@ var init_formatters = __esm({
586
586
  }
587
587
  });
588
588
 
589
- // src/utils/test/contract/contract.json
590
- var contract_default;
591
- var init_contract = __esm({
592
- "src/utils/test/contract/contract.json"() {
593
- contract_default = {
594
- menu: {
595
- path: "./aria-contracts/menu/menu.contract.json",
596
- component: "menu"
597
- },
598
- "combobox.listbox": {
599
- path: "./aria-contracts/combobox/combobox.listbox.contract.json",
600
- component: "combobox.listbox"
601
- },
602
- accordion: {
603
- path: "./aria-contracts/accordion/accordion.contract.json",
604
- component: "accordion"
605
- },
606
- tabs: {
607
- path: "./aria-contracts/tabs/tabs.contract.json",
608
- component: "tabs"
609
- }
610
- };
611
- }
612
- });
613
-
614
589
  // src/utils/test/src/ContractReporter.ts
615
590
  var ContractReporter;
616
591
  var init_ContractReporter = __esm({
@@ -914,16 +889,13 @@ var init_strictness = __esm({
914
889
  });
915
890
 
916
891
  // src/utils/test/src/contractTestRunner.ts
917
- async function runContractTests(componentName, component, strictness) {
892
+ async function runContractTests(contractPath, componentName, component, strictness) {
918
893
  const reporter = new ContractReporter(false);
919
894
  const strictnessMode = normalizeStrictness(strictness);
920
- const contractTyped = contract_default;
921
- const contractPath = contractTyped[componentName]?.path;
922
895
  if (!contractPath) {
923
- throw new Error(`No contract found for component: ${componentName}`);
896
+ throw new Error(`No contract path provided for component: ${componentName}`);
924
897
  }
925
- const resolvedPath = new URL(contractPath, import_meta.url).pathname;
926
- const contractData = await import_promises.default.readFile(resolvedPath, "utf-8");
898
+ const contractData = await import_promises.default.readFile(contractPath, "utf-8");
927
899
  const componentContract = JSON.parse(contractData);
928
900
  const totalTests = (componentContract.relationships?.length || 0) + (componentContract.static[0]?.assertions.length || 0) + componentContract.dynamic.length;
929
901
  reporter.start(componentName, totalTests);
@@ -1078,15 +1050,13 @@ async function runContractTests(componentName, component, strictness) {
1078
1050
  reporter.summary(failures);
1079
1051
  return { passes, failures, skipped, warnings };
1080
1052
  }
1081
- var import_promises, import_meta;
1053
+ var import_promises;
1082
1054
  var init_contractTestRunner = __esm({
1083
1055
  "src/utils/test/src/contractTestRunner.ts"() {
1084
1056
  "use strict";
1085
- init_contract();
1086
1057
  import_promises = __toESM(require("fs/promises"), 1);
1087
1058
  init_ContractReporter();
1088
1059
  init_strictness();
1089
- import_meta = {};
1090
1060
  }
1091
1061
  });
1092
1062
 
@@ -1428,12 +1398,6 @@ var init_StrategyRegistry = __esm({
1428
1398
  (m) => m.TabsComponentStrategy
1429
1399
  )
1430
1400
  );
1431
- this.builtInStrategies.set(
1432
- "combobox.listbox",
1433
- () => Promise.resolve().then(() => (init_ComboboxComponentStrategy(), ComboboxComponentStrategy_exports)).then(
1434
- (m) => m.ComboboxComponentStrategy
1435
- )
1436
- );
1437
1401
  }
1438
1402
  /**
1439
1403
  * Load a strategy - either from custom path or built-in registry
@@ -1480,15 +1444,14 @@ var init_StrategyRegistry = __esm({
1480
1444
  });
1481
1445
 
1482
1446
  // src/utils/test/src/ComponentDetector.ts
1483
- var import_fs, import_path4, import_meta2, ComponentDetector;
1447
+ var import_fs, import_path4, import_meta, ComponentDetector;
1484
1448
  var init_ComponentDetector = __esm({
1485
1449
  "src/utils/test/src/ComponentDetector.ts"() {
1486
1450
  "use strict";
1487
1451
  import_fs = require("fs");
1488
1452
  import_path4 = __toESM(require("path"), 1);
1489
- init_contract();
1490
1453
  init_StrategyRegistry();
1491
- import_meta2 = {};
1454
+ import_meta = {};
1492
1455
  ComponentDetector = class {
1493
1456
  static strategyRegistry = new StrategyRegistry();
1494
1457
  static isComponentConfig(value) {
@@ -1508,11 +1471,7 @@ var init_ComponentDetector = __esm({
1508
1471
  */
1509
1472
  static async detect(componentName, componentConfig, actionTimeoutMs = 400, assertionTimeoutMs = 400, configBaseDir) {
1510
1473
  const typedComponentConfig = this.isComponentConfig(componentConfig) ? componentConfig : void 0;
1511
- let contractPath = typedComponentConfig?.path;
1512
- if (!contractPath) {
1513
- const contractTyped = contract_default;
1514
- contractPath = contractTyped[componentName]?.path;
1515
- }
1474
+ const contractPath = typedComponentConfig?.contractPath;
1516
1475
  if (!contractPath) {
1517
1476
  throw new Error(`Contract path not found for component: ${componentName}`);
1518
1477
  }
@@ -1531,7 +1490,7 @@ var init_ComponentDetector = __esm({
1531
1490
  (0, import_fs.readFileSync)(cwdResolved, "utf-8");
1532
1491
  return cwdResolved;
1533
1492
  } catch {
1534
- return new URL(contractPath, import_meta2.url).pathname;
1493
+ return new URL(contractPath, import_meta.url).pathname;
1535
1494
  }
1536
1495
  })();
1537
1496
  const contractData = (0, import_fs.readFileSync)(resolvedPath, "utf-8");
@@ -1545,7 +1504,7 @@ var init_ComponentDetector = __esm({
1545
1504
  if (!strategyClass) {
1546
1505
  return null;
1547
1506
  }
1548
- const mainSelector = selectors.trigger || selectors.input || selectors.tablist || selectors.container;
1507
+ const mainSelector = selectors.main;
1549
1508
  if (componentName === "tabs") {
1550
1509
  return new strategyClass(mainSelector, selectors);
1551
1510
  }
@@ -2120,7 +2079,7 @@ __export(contractTestRunnerPlaywright_exports, {
2120
2079
  });
2121
2080
  async function runContractTestsPlaywright(componentName, url, strictness, config, configBaseDir) {
2122
2081
  const componentConfig = config?.test?.components?.find((c) => c.name === componentName);
2123
- const isCustomContract = !!componentConfig?.path;
2082
+ const isCustomContract = !!componentConfig?.contractPath;
2124
2083
  const reporter = new ContractReporter(true, isCustomContract);
2125
2084
  const defaultTimeouts = {
2126
2085
  actionTimeoutMs: 400,
@@ -2160,11 +2119,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
2160
2119
  defaultTimeouts.componentReadyTimeoutMs
2161
2120
  );
2162
2121
  const strictnessMode = normalizeStrictness(strictness);
2163
- let contractPath = componentConfig?.path;
2164
- if (!contractPath) {
2165
- const contractTyped = contract_default;
2166
- contractPath = contractTyped[componentName]?.path;
2167
- }
2122
+ const contractPath = componentConfig?.contractPath;
2168
2123
  if (!contractPath) {
2169
2124
  throw new Error(`Contract path not found for component: ${componentName}`);
2170
2125
  }
@@ -2183,7 +2138,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
2183
2138
  (0, import_fs2.readFileSync)(cwdResolved, "utf-8");
2184
2139
  return cwdResolved;
2185
2140
  } catch {
2186
- return new URL(contractPath, import_meta3.url).pathname;
2141
+ return new URL(contractPath, import_meta2.url).pathname;
2187
2142
  }
2188
2143
  })();
2189
2144
  const contractData = (0, import_fs2.readFileSync)(resolvedPath, "utf-8");
@@ -2655,20 +2610,19 @@ This usually means:
2655
2610
  }
2656
2611
  return { passes, failures, skipped, warnings };
2657
2612
  }
2658
- var import_fs2, import_path5, import_meta3;
2613
+ var import_fs2, import_path5, import_meta2;
2659
2614
  var init_contractTestRunnerPlaywright = __esm({
2660
2615
  "src/utils/test/src/contractTestRunnerPlaywright.ts"() {
2661
2616
  "use strict";
2662
2617
  import_fs2 = require("fs");
2663
2618
  import_path5 = __toESM(require("path"), 1);
2664
- init_contract();
2665
2619
  init_playwrightTestHarness();
2666
2620
  init_ComponentDetector();
2667
2621
  init_ContractReporter();
2668
2622
  init_ActionExecutor();
2669
2623
  init_AssertionRunner();
2670
2624
  init_strictness();
2671
- import_meta3 = {};
2625
+ import_meta2 = {};
2672
2626
  }
2673
2627
  });
2674
2628
 
@@ -2747,7 +2701,16 @@ Please start your dev server and try again.`
2747
2701
  }
2748
2702
  } else if (component) {
2749
2703
  console.log(`\u{1F3AD} Running component contract tests in JSDOM mode`);
2750
- contract = await runContractTests(componentName, component, strictness);
2704
+ const contractPath = config.test?.components?.find((comp) => comp?.name === componentName)?.contractPath;
2705
+ if (!contractPath) {
2706
+ throw new Error(`\u274C No contract path found for component: ${componentName}`);
2707
+ }
2708
+ contract = await runContractTests(
2709
+ import_path6.default.resolve(configBaseDir, contractPath),
2710
+ componentName,
2711
+ component,
2712
+ strictness
2713
+ );
2751
2714
  } else {
2752
2715
  throw new Error("\u274C Either component or URL must be provided");
2753
2716
  }
package/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  loadConfig
4
- } from "./chunk-NI3MQCAS.js";
4
+ } from "./chunk-GJGUY643.js";
5
5
  import {
6
6
  displayBadgeInfo,
7
7
  promptAddBadge
@@ -122,13 +122,13 @@ program.command("audit").description("Run axe-core powered accessibility audit o
122
122
  process.exit(1);
123
123
  });
124
124
  program.command("test").description("Run core a11y accessibility standard tests on UI components").action(async () => {
125
- const { runTest } = await import("./test-O3J4ZPQR.js");
125
+ const { runTest } = await import("./test-HBPCSYH5.js");
126
126
  runTest();
127
127
  });
128
128
  program.command("build").description("Build accessibility artifacts").addCommand(
129
129
  new Command("contracts").description("Build DSL contracts to JSON").action(async () => {
130
130
  const { buildContracts } = await import("./buildContracts-FT6KWUJN.js");
131
- const { loadConfig: loadConfig2 } = await import("./configLoader-UJZHQBYS.js");
131
+ const { loadConfig: loadConfig2 } = await import("./configLoader-REHK3S3Q.js");
132
132
  const cwd = process.cwd();
133
133
  const { config, configPath, errors } = await loadConfig2(cwd);
134
134
  if (configPath) {
@@ -70,8 +70,8 @@ function validateConfig(config) {
70
70
  if (typeof comp.name !== "string") {
71
71
  errors.push(`test.components[${idx}].name must be a string`);
72
72
  }
73
- if (comp.path !== void 0 && typeof comp.path !== "string") {
74
- errors.push(`test.components[${idx}].path must be a string when provided`);
73
+ if (comp.contractPath !== void 0 && typeof comp.contractPath !== "string") {
74
+ errors.push(`test.components[${idx}].contractPath must be a string when provided`);
75
75
  }
76
76
  if (comp.strategyPath !== void 0 && typeof comp.strategyPath !== "string") {
77
77
  errors.push(`test.components[${idx}].strategyPath must be a string when provided`);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadConfig
3
- } from "./chunk-NI3MQCAS.js";
3
+ } from "./chunk-GJGUY643.js";
4
4
  import "./chunk-I2KLQ2HA.js";
5
5
  export {
6
6
  loadConfig
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  ContractReporter,
3
- contract_default,
4
3
  createTestPage,
5
4
  normalizeLevel,
6
5
  normalizeStrictness,
7
6
  resolveEnforcement
8
- } from "./chunk-XERMSYEH.js";
7
+ } from "./chunk-FZ7GMIJB.js";
9
8
  import {
10
9
  test_exports
11
10
  } from "./chunk-PK5L2SAF.js";
@@ -55,12 +54,6 @@ var StrategyRegistry = class {
55
54
  (m) => m.TabsComponentStrategy
56
55
  )
57
56
  );
58
- this.builtInStrategies.set(
59
- "combobox.listbox",
60
- () => import("./ComboboxComponentStrategy-OGRVZXAF.js").then(
61
- (m) => m.ComboboxComponentStrategy
62
- )
63
- );
64
57
  }
65
58
  /**
66
59
  * Load a strategy - either from custom path or built-in registry
@@ -124,11 +117,7 @@ var ComponentDetector = class {
124
117
  */
125
118
  static async detect(componentName, componentConfig, actionTimeoutMs = 400, assertionTimeoutMs = 400, configBaseDir) {
126
119
  const typedComponentConfig = this.isComponentConfig(componentConfig) ? componentConfig : void 0;
127
- let contractPath = typedComponentConfig?.path;
128
- if (!contractPath) {
129
- const contractTyped = contract_default;
130
- contractPath = contractTyped[componentName]?.path;
131
- }
120
+ const contractPath = typedComponentConfig?.contractPath;
132
121
  if (!contractPath) {
133
122
  throw new Error(`Contract path not found for component: ${componentName}`);
134
123
  }
@@ -161,7 +150,7 @@ var ComponentDetector = class {
161
150
  if (!strategyClass) {
162
151
  return null;
163
152
  }
164
- const mainSelector = selectors.trigger || selectors.input || selectors.tablist || selectors.container;
153
+ const mainSelector = selectors.main;
165
154
  if (componentName === "tabs") {
166
155
  return new strategyClass(mainSelector, selectors);
167
156
  }
@@ -709,7 +698,7 @@ var AssertionRunner = class {
709
698
  // src/utils/test/src/contractTestRunnerPlaywright.ts
710
699
  async function runContractTestsPlaywright(componentName, url, strictness, config, configBaseDir) {
711
700
  const componentConfig = config?.test?.components?.find((c) => c.name === componentName);
712
- const isCustomContract = !!componentConfig?.path;
701
+ const isCustomContract = !!componentConfig?.contractPath;
713
702
  const reporter = new ContractReporter(true, isCustomContract);
714
703
  const defaultTimeouts = {
715
704
  actionTimeoutMs: 400,
@@ -749,11 +738,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
749
738
  defaultTimeouts.componentReadyTimeoutMs
750
739
  );
751
740
  const strictnessMode = normalizeStrictness(strictness);
752
- let contractPath = componentConfig?.path;
753
- if (!contractPath) {
754
- const contractTyped = contract_default;
755
- contractPath = contractTyped[componentName]?.path;
756
- }
741
+ const contractPath = componentConfig?.contractPath;
757
742
  if (!contractPath) {
758
743
  throw new Error(`Contract path not found for component: ${componentName}`);
759
744
  }
@@ -1,11 +1,10 @@
1
1
  import {
2
2
  ContractReporter,
3
- contract_default,
4
3
  createTestPage,
5
4
  normalizeLevel,
6
5
  normalizeStrictness,
7
6
  resolveEnforcement
8
- } from "./chunk-XERMSYEH.js";
7
+ } from "./chunk-FZ7GMIJB.js";
9
8
  import {
10
9
  test_exports
11
10
  } from "./chunk-PK5L2SAF.js";
@@ -55,12 +54,6 @@ var StrategyRegistry = class {
55
54
  (m) => m.TabsComponentStrategy
56
55
  )
57
56
  );
58
- this.builtInStrategies.set(
59
- "combobox.listbox",
60
- () => import("./ComboboxComponentStrategy-OGRVZXAF.js").then(
61
- (m) => m.ComboboxComponentStrategy
62
- )
63
- );
64
57
  }
65
58
  /**
66
59
  * Load a strategy - either from custom path or built-in registry
@@ -124,11 +117,7 @@ var ComponentDetector = class {
124
117
  */
125
118
  static async detect(componentName, componentConfig, actionTimeoutMs = 400, assertionTimeoutMs = 400, configBaseDir) {
126
119
  const typedComponentConfig = this.isComponentConfig(componentConfig) ? componentConfig : void 0;
127
- let contractPath = typedComponentConfig?.path;
128
- if (!contractPath) {
129
- const contractTyped = contract_default;
130
- contractPath = contractTyped[componentName]?.path;
131
- }
120
+ const contractPath = typedComponentConfig?.contractPath;
132
121
  if (!contractPath) {
133
122
  throw new Error(`Contract path not found for component: ${componentName}`);
134
123
  }
@@ -161,7 +150,7 @@ var ComponentDetector = class {
161
150
  if (!strategyClass) {
162
151
  return null;
163
152
  }
164
- const mainSelector = selectors.trigger || selectors.input || selectors.tablist || selectors.container;
153
+ const mainSelector = selectors.main;
165
154
  if (componentName === "tabs") {
166
155
  return new strategyClass(mainSelector, selectors);
167
156
  }
@@ -709,7 +698,7 @@ var AssertionRunner = class {
709
698
  // src/utils/test/src/contractTestRunnerPlaywright.ts
710
699
  async function runContractTestsPlaywright(componentName, url, strictness, config, configBaseDir) {
711
700
  const componentConfig = config?.test?.components?.find((c) => c.name === componentName);
712
- const isCustomContract = !!componentConfig?.path;
701
+ const isCustomContract = !!componentConfig?.contractPath;
713
702
  const reporter = new ContractReporter(true, isCustomContract);
714
703
  const defaultTimeouts = {
715
704
  actionTimeoutMs: 400,
@@ -749,11 +738,7 @@ async function runContractTestsPlaywright(componentName, url, strictness, config
749
738
  defaultTimeouts.componentReadyTimeoutMs
750
739
  );
751
740
  const strictnessMode = normalizeStrictness(strictness);
752
- let contractPath = componentConfig?.path;
753
- if (!contractPath) {
754
- const contractTyped = contract_default;
755
- contractPath = contractTyped[componentName]?.path;
756
- }
741
+ const contractPath = componentConfig?.contractPath;
757
742
  if (!contractPath) {
758
743
  throw new Error(`Contract path not found for component: ${componentName}`);
759
744
  }