aria-ease 6.9.1 → 6.10.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 (43) hide show
  1. package/README.md +3 -3
  2. package/bin/{buildContracts-GBOY7UXG.js → buildContracts-S22V7AGV.js} +28 -0
  3. package/bin/{chunk-LMSKLN5O.js → chunk-NI3MQCAS.js} +34 -0
  4. package/bin/cli.cjs +235 -20
  5. package/bin/cli.js +4 -4
  6. package/bin/{configLoader-Q6A4JLKW.js → configLoader-UJZHQBYS.js} +1 -1
  7. package/{dist/contractTestRunnerPlaywright-XBWJZMR3.js → bin/contractTestRunnerPlaywright-QDXSK3FE.js} +173 -20
  8. package/bin/{test-OND56UUL.js → test-O3J4ZPQR.js} +2 -2
  9. package/dist/{configLoader-WTGJAP4Z.js → configLoader-DWHOHXHL.js} +34 -0
  10. package/{bin/contractTestRunnerPlaywright-ZZNWDUYP.js → dist/contractTestRunnerPlaywright-WNWQYSXZ.js} +173 -20
  11. package/dist/index.cjs +492 -298
  12. package/dist/index.d.cts +53 -53
  13. package/dist/index.d.ts +53 -53
  14. package/dist/index.js +289 -282
  15. package/dist/src/{Types.d-DYfYR3Vc.d.cts → Types.d-yGC2bBaB.d.cts} +1 -1
  16. package/dist/src/{Types.d-DYfYR3Vc.d.ts → Types.d-yGC2bBaB.d.ts} +1 -1
  17. package/dist/src/accordion/index.d.cts +1 -1
  18. package/dist/src/accordion/index.d.ts +1 -1
  19. package/dist/src/block/index.d.cts +1 -1
  20. package/dist/src/block/index.d.ts +1 -1
  21. package/dist/src/checkbox/index.d.cts +1 -1
  22. package/dist/src/checkbox/index.d.ts +1 -1
  23. package/dist/src/combobox/index.cjs +21 -7
  24. package/dist/src/combobox/index.d.cts +1 -1
  25. package/dist/src/combobox/index.d.ts +1 -1
  26. package/dist/src/combobox/index.js +21 -7
  27. package/dist/src/menu/index.d.cts +1 -1
  28. package/dist/src/menu/index.d.ts +1 -1
  29. package/dist/src/radio/index.d.cts +1 -1
  30. package/dist/src/radio/index.d.ts +1 -1
  31. package/dist/src/tabs/index.d.cts +1 -1
  32. package/dist/src/tabs/index.d.ts +1 -1
  33. package/dist/src/toggle/index.d.cts +1 -1
  34. package/dist/src/toggle/index.d.ts +1 -1
  35. package/dist/src/utils/test/{configLoader-YE2CYGDG.js → configLoader-SHJSRG2A.js} +34 -0
  36. package/dist/src/utils/test/{contractTestRunnerPlaywright-LC5OAVXB.js → contractTestRunnerPlaywright-Z2AHXSNM.js} +173 -20
  37. package/dist/src/utils/test/dsl/index.cjs +263 -270
  38. package/dist/src/utils/test/dsl/index.d.cts +53 -53
  39. package/dist/src/utils/test/dsl/index.d.ts +53 -53
  40. package/dist/src/utils/test/dsl/index.js +263 -270
  41. package/dist/src/utils/test/index.cjs +207 -20
  42. package/dist/src/utils/test/index.js +2 -2
  43. package/package.json +1 -1
@@ -1,3 +1,8 @@
1
+ type StatePack = Record<string, {
2
+ setup?: DynamicAction[];
3
+ assertion?: DynamicAssertion[] | DynamicAssertion;
4
+ requires?: string[];
5
+ }>;
1
6
  type Level = "required" | "recommended" | "optional";
2
7
  type ContractMeta = {
3
8
  id?: string;
@@ -29,13 +34,6 @@ type StaticAssertion = {
29
34
  failureMessage: string;
30
35
  level: Level;
31
36
  };
32
- type DynamicAction = {
33
- type: "focus" | "type" | "click" | "keypress" | "hover";
34
- target: string;
35
- key?: string;
36
- value?: string;
37
- relativeTarget?: string;
38
- };
39
37
  type DynamicAssertion = {
40
38
  target: string;
41
39
  assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "toHaveRole";
@@ -43,8 +41,22 @@ type DynamicAssertion = {
43
41
  expectedValue?: string;
44
42
  failureMessage?: string;
45
43
  relativeTarget?: string;
44
+ virtualId?: string;
45
+ selectorKey?: string;
46
46
  level?: Level;
47
47
  };
48
+ type DynamicAction = {
49
+ type: "focus";
50
+ target: string;
51
+ relativeTarget?: "first" | "last" | "next" | "previous";
52
+ virtualId?: string;
53
+ } | {
54
+ type: "click" | "keypress" | "type" | "hover";
55
+ target: string;
56
+ key?: string;
57
+ value?: string;
58
+ relativeTarget?: string;
59
+ };
48
60
  type DynamicTest = {
49
61
  description: string;
50
62
  level?: Level;
@@ -65,42 +77,6 @@ declare class FluentContract {
65
77
  constructor(jsonContract: JsonContract);
66
78
  toJSON(): JsonContract;
67
79
  }
68
- declare class StaticTargetBuilder {
69
- private readonly targetName;
70
- private readonly sink;
71
- constructor(targetName: string, sink: StaticAssertion[]);
72
- has(attribute: string, expectedValue?: string): {
73
- required: () => void;
74
- recommended: () => void;
75
- optional: () => void;
76
- };
77
- }
78
- declare class StaticBuilder {
79
- private readonly sink;
80
- constructor(sink: StaticAssertion[]);
81
- target(targetName: string): StaticTargetBuilder;
82
- }
83
- declare class DynamicChain {
84
- private readonly key;
85
- private readonly testsSink;
86
- private readonly selectors;
87
- private selectorTarget;
88
- private readonly actions;
89
- private readonly assertions;
90
- private explicitDescription;
91
- constructor(key: string, testsSink: DynamicTest[], selectors: SelectorsMap);
92
- on(target: string): this;
93
- describe(description: string): this;
94
- focus(targetExpression: string): this;
95
- visible(target: string): this;
96
- hidden(target: string): this;
97
- has(target: string, attribute: string, expectedValue?: string): this;
98
- required(): void;
99
- recommended(): void;
100
- optional(): void;
101
- private finalize;
102
- private parseRelativeExpression;
103
- }
104
80
  declare class ContractBuilder {
105
81
  private readonly componentName;
106
82
  private metaValue;
@@ -108,29 +84,53 @@ declare class ContractBuilder {
108
84
  private readonly relationshipInvariants;
109
85
  private readonly staticAssertions;
110
86
  private readonly dynamicTests;
87
+ private statePack;
111
88
  constructor(componentName: string);
112
89
  meta(meta: ContractMeta): this;
113
90
  selectors(selectors: SelectorsMap): this;
114
- relationship(invariant: RelationshipInvariant): this;
115
- relationships(builderFn: (r: {
91
+ relationships(fn: (r: {
116
92
  ariaReference: (from: string, attribute: string, to: string) => {
117
93
  required: () => void;
118
- recommended: () => void;
119
94
  optional: () => void;
120
95
  };
121
96
  contains: (parent: string, child: string) => {
122
97
  required: () => void;
123
- recommended: () => void;
124
98
  optional: () => void;
125
99
  };
126
100
  }) => void): this;
127
- static(builderFn: (s: StaticBuilder) => void): this;
128
- when(key: string): DynamicChain;
129
- private validateRelationshipInvariants;
130
- private validateStaticTargets;
131
- private validateDynamicTargets;
101
+ static(fn: (s: {
102
+ target: (target: string) => {
103
+ has: (attribute: string, expectedValue: string) => {
104
+ required: () => void;
105
+ optional: () => void;
106
+ };
107
+ };
108
+ }) => void): this;
109
+ when(event: string): DynamicTestBuilder;
110
+ addDynamicTest(test: DynamicTest): void;
132
111
  build(): JsonContract;
133
112
  }
113
+ declare class DynamicTestBuilder {
114
+ private parent;
115
+ private statePack;
116
+ private event;
117
+ private _as;
118
+ private _on;
119
+ private _given;
120
+ private _then;
121
+ private _desc;
122
+ private _level;
123
+ constructor(parent: ContractBuilder, statePack: StatePack, event: string);
124
+ as(actionType: string): this;
125
+ on(target: string): this;
126
+ given(states: string | string[]): this;
127
+ then(states: string | string[]): this;
128
+ describe(desc: string): this;
129
+ required(): ContractBuilder;
130
+ optional(): ContractBuilder;
131
+ recommended(): ContractBuilder;
132
+ private _finalize;
133
+ }
134
134
  declare function createContract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
135
135
 
136
- export { ContractBuilder, type JsonContract, type RelationshipInvariant, createContract };
136
+ export { createContract };
@@ -1,3 +1,8 @@
1
+ type StatePack = Record<string, {
2
+ setup?: DynamicAction[];
3
+ assertion?: DynamicAssertion[] | DynamicAssertion;
4
+ requires?: string[];
5
+ }>;
1
6
  type Level = "required" | "recommended" | "optional";
2
7
  type ContractMeta = {
3
8
  id?: string;
@@ -29,13 +34,6 @@ type StaticAssertion = {
29
34
  failureMessage: string;
30
35
  level: Level;
31
36
  };
32
- type DynamicAction = {
33
- type: "focus" | "type" | "click" | "keypress" | "hover";
34
- target: string;
35
- key?: string;
36
- value?: string;
37
- relativeTarget?: string;
38
- };
39
37
  type DynamicAssertion = {
40
38
  target: string;
41
39
  assertion: "toBeVisible" | "notToBeVisible" | "toHaveAttribute" | "toHaveValue" | "toHaveFocus" | "toHaveRole";
@@ -43,8 +41,22 @@ type DynamicAssertion = {
43
41
  expectedValue?: string;
44
42
  failureMessage?: string;
45
43
  relativeTarget?: string;
44
+ virtualId?: string;
45
+ selectorKey?: string;
46
46
  level?: Level;
47
47
  };
48
+ type DynamicAction = {
49
+ type: "focus";
50
+ target: string;
51
+ relativeTarget?: "first" | "last" | "next" | "previous";
52
+ virtualId?: string;
53
+ } | {
54
+ type: "click" | "keypress" | "type" | "hover";
55
+ target: string;
56
+ key?: string;
57
+ value?: string;
58
+ relativeTarget?: string;
59
+ };
48
60
  type DynamicTest = {
49
61
  description: string;
50
62
  level?: Level;
@@ -65,42 +77,6 @@ declare class FluentContract {
65
77
  constructor(jsonContract: JsonContract);
66
78
  toJSON(): JsonContract;
67
79
  }
68
- declare class StaticTargetBuilder {
69
- private readonly targetName;
70
- private readonly sink;
71
- constructor(targetName: string, sink: StaticAssertion[]);
72
- has(attribute: string, expectedValue?: string): {
73
- required: () => void;
74
- recommended: () => void;
75
- optional: () => void;
76
- };
77
- }
78
- declare class StaticBuilder {
79
- private readonly sink;
80
- constructor(sink: StaticAssertion[]);
81
- target(targetName: string): StaticTargetBuilder;
82
- }
83
- declare class DynamicChain {
84
- private readonly key;
85
- private readonly testsSink;
86
- private readonly selectors;
87
- private selectorTarget;
88
- private readonly actions;
89
- private readonly assertions;
90
- private explicitDescription;
91
- constructor(key: string, testsSink: DynamicTest[], selectors: SelectorsMap);
92
- on(target: string): this;
93
- describe(description: string): this;
94
- focus(targetExpression: string): this;
95
- visible(target: string): this;
96
- hidden(target: string): this;
97
- has(target: string, attribute: string, expectedValue?: string): this;
98
- required(): void;
99
- recommended(): void;
100
- optional(): void;
101
- private finalize;
102
- private parseRelativeExpression;
103
- }
104
80
  declare class ContractBuilder {
105
81
  private readonly componentName;
106
82
  private metaValue;
@@ -108,29 +84,53 @@ declare class ContractBuilder {
108
84
  private readonly relationshipInvariants;
109
85
  private readonly staticAssertions;
110
86
  private readonly dynamicTests;
87
+ private statePack;
111
88
  constructor(componentName: string);
112
89
  meta(meta: ContractMeta): this;
113
90
  selectors(selectors: SelectorsMap): this;
114
- relationship(invariant: RelationshipInvariant): this;
115
- relationships(builderFn: (r: {
91
+ relationships(fn: (r: {
116
92
  ariaReference: (from: string, attribute: string, to: string) => {
117
93
  required: () => void;
118
- recommended: () => void;
119
94
  optional: () => void;
120
95
  };
121
96
  contains: (parent: string, child: string) => {
122
97
  required: () => void;
123
- recommended: () => void;
124
98
  optional: () => void;
125
99
  };
126
100
  }) => void): this;
127
- static(builderFn: (s: StaticBuilder) => void): this;
128
- when(key: string): DynamicChain;
129
- private validateRelationshipInvariants;
130
- private validateStaticTargets;
131
- private validateDynamicTargets;
101
+ static(fn: (s: {
102
+ target: (target: string) => {
103
+ has: (attribute: string, expectedValue: string) => {
104
+ required: () => void;
105
+ optional: () => void;
106
+ };
107
+ };
108
+ }) => void): this;
109
+ when(event: string): DynamicTestBuilder;
110
+ addDynamicTest(test: DynamicTest): void;
132
111
  build(): JsonContract;
133
112
  }
113
+ declare class DynamicTestBuilder {
114
+ private parent;
115
+ private statePack;
116
+ private event;
117
+ private _as;
118
+ private _on;
119
+ private _given;
120
+ private _then;
121
+ private _desc;
122
+ private _level;
123
+ constructor(parent: ContractBuilder, statePack: StatePack, event: string);
124
+ as(actionType: string): this;
125
+ on(target: string): this;
126
+ given(states: string | string[]): this;
127
+ then(states: string | string[]): this;
128
+ describe(desc: string): this;
129
+ required(): ContractBuilder;
130
+ optional(): ContractBuilder;
131
+ recommended(): ContractBuilder;
132
+ private _finalize;
133
+ }
134
134
  declare function createContract(componentName: string, define: (c: ContractBuilder) => void): FluentContract;
135
135
 
136
- export { ContractBuilder, type JsonContract, type RelationshipInvariant, createContract };
136
+ export { createContract };