aria-ease 6.10.0 → 6.11.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.
- package/README.md +1 -1
- package/{bin/buildContracts-S22V7AGV.js → dist/buildContracts-FT6KWUJN.js} +3 -3
- package/{bin → dist}/cli.cjs +4 -4
- package/{bin → dist}/cli.js +1 -1
- package/dist/index.cjs +132 -56
- package/dist/index.js +132 -56
- package/dist/src/{Types.d-yGC2bBaB.d.ts → Types.d-DYfYR3Vc.d.cts} +1 -1
- package/dist/src/{Types.d-yGC2bBaB.d.cts → Types.d-DYfYR3Vc.d.ts} +1 -1
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/block/index.d.cts +1 -1
- package/dist/src/block/index.d.ts +1 -1
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/combobox/index.d.cts +1 -1
- package/dist/src/combobox/index.d.ts +1 -1
- package/dist/src/menu/index.d.cts +1 -1
- package/dist/src/menu/index.d.ts +1 -1
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/tabs/index.d.cts +1 -1
- package/dist/src/tabs/index.d.ts +1 -1
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/dist/src/utils/test/dsl/index.cjs +132 -56
- package/dist/src/utils/test/dsl/index.js +132 -56
- package/package.json +4 -5
- package/bin/AccordionComponentStrategy-4ZEIQ2V6.js +0 -42
- package/bin/ComboboxComponentStrategy-OGRVZXAF.js +0 -64
- package/bin/MenuComponentStrategy-JAMTCSNF.js +0 -81
- package/bin/TabsComponentStrategy-3SQURPMX.js +0 -29
- package/bin/chunk-I2KLQ2HA.js +0 -22
- package/bin/chunk-PK5L2SAF.js +0 -17
- package/bin/chunk-XERMSYEH.js +0 -363
- /package/{bin → dist}/audit-RM6TCZ5C.js +0 -0
- /package/{bin → dist}/badgeHelper-JOWO6RQG.js +0 -0
- /package/{bin → dist}/chunk-JJEPLK7L.js +0 -0
- /package/{bin → dist}/chunk-NI3MQCAS.js +0 -0
- /package/{bin → dist}/cli.d.cts +0 -0
- /package/{bin → dist}/cli.d.ts +0 -0
- /package/{bin → dist}/configLoader-UJZHQBYS.js +0 -0
- /package/{bin → dist}/contractTestRunnerPlaywright-QDXSK3FE.js +0 -0
- /package/{bin → dist}/formatters-32KQIIYS.js +0 -0
- /package/{bin → dist}/test-O3J4ZPQR.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComboboxConfig,
|
|
1
|
+
import { C as ComboboxConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Makes a Combobox accessible by adding appropriate ARIA attributes, keyboard interactions and focus management.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig,
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
package/dist/src/menu/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as MenuConfig,
|
|
1
|
+
import { M as MenuConfig, a as AccessibilityInstance } from '../Types.d-DYfYR3Vc.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Adds keyboard interaction to toggle menu. The menu traps focus and can be interacted with using the keyboard. The first interactive item of the menu has focus when menu open.
|
package/dist/src/tabs/index.d.ts
CHANGED
|
@@ -1,90 +1,141 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// src/utils/test/dsl/src/state-packs/comboboxStatePack.ts
|
|
4
|
+
function hasCapabilities(ctx, requiredCaps) {
|
|
5
|
+
return requiredCaps.some((cap) => ctx.capabilities.includes(cap));
|
|
6
|
+
}
|
|
7
|
+
function resolveSetup(setup, ctx) {
|
|
8
|
+
if (Array.isArray(setup) && setup.length && !setup[0].when) {
|
|
9
|
+
setup = [{ when: ["keyboard"], steps: () => setup }];
|
|
10
|
+
}
|
|
11
|
+
for (const strat of setup) {
|
|
12
|
+
if (hasCapabilities(ctx, strat.when)) {
|
|
13
|
+
return strat.steps(ctx);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
throw new Error(
|
|
17
|
+
`No setup strategy matches capabilities: ${ctx.capabilities.join(", ")}`
|
|
18
|
+
);
|
|
19
|
+
}
|
|
4
20
|
var COMBOBOX_STATES = {
|
|
5
21
|
"listbox.open": {
|
|
6
|
-
setup:
|
|
7
|
-
|
|
22
|
+
setup: [
|
|
23
|
+
{
|
|
24
|
+
when: ["keyboard", "textInput"],
|
|
25
|
+
steps: () => [
|
|
26
|
+
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
when: ["pointer"],
|
|
31
|
+
steps: () => [
|
|
32
|
+
{ type: "click", target: "button" }
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
assertion: isComboboxOpen
|
|
8
37
|
},
|
|
9
38
|
"listbox.closed": {
|
|
10
|
-
setup:
|
|
11
|
-
|
|
39
|
+
setup: [
|
|
40
|
+
{
|
|
41
|
+
when: ["keyboard"],
|
|
42
|
+
steps: () => [
|
|
43
|
+
/* { type: "keypress", target: "input", key: "Escape" } */
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
when: ["pointer"],
|
|
48
|
+
steps: () => [
|
|
49
|
+
/* { type: "click", target: "button" } */
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
assertion: isComboboxClosed
|
|
12
54
|
},
|
|
13
55
|
"input.focused": {
|
|
14
|
-
setup:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
56
|
+
setup: [
|
|
57
|
+
{
|
|
58
|
+
when: ["keyboard"],
|
|
59
|
+
steps: () => [
|
|
60
|
+
{ type: "focus", target: "input" }
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
assertion: isInputFocused
|
|
18
65
|
},
|
|
19
66
|
"input.filled": {
|
|
20
|
-
setup:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
67
|
+
setup: [
|
|
68
|
+
{
|
|
69
|
+
when: ["keyboard", "textInput"],
|
|
70
|
+
steps: () => [
|
|
71
|
+
{ type: "type", target: "input", value: "test" }
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
assertion: isInputFilled
|
|
24
76
|
},
|
|
25
77
|
"activeOption.first": {
|
|
26
78
|
requires: ["listbox.open"],
|
|
27
79
|
setup: [
|
|
28
|
-
{
|
|
80
|
+
{
|
|
81
|
+
when: ["keyboard"],
|
|
82
|
+
steps: () => [
|
|
83
|
+
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
29
86
|
],
|
|
30
|
-
assertion:
|
|
31
|
-
...isActiveDescendantNotEmpty()
|
|
32
|
-
]
|
|
87
|
+
assertion: isActiveDescendantNotEmpty
|
|
33
88
|
},
|
|
34
89
|
"activeOption.last": {
|
|
35
90
|
requires: ["activeOption.first"],
|
|
36
91
|
setup: [
|
|
37
|
-
{
|
|
92
|
+
{
|
|
93
|
+
when: ["keyboard"],
|
|
94
|
+
steps: () => [
|
|
95
|
+
{ type: "keypress", target: "input", key: "ArrowUp" }
|
|
96
|
+
]
|
|
97
|
+
}
|
|
38
98
|
],
|
|
39
|
-
assertion:
|
|
40
|
-
...isActiveDescendantNotEmpty()
|
|
41
|
-
]
|
|
99
|
+
assertion: isActiveDescendantNotEmpty
|
|
42
100
|
},
|
|
43
101
|
"selectedOption.first": {
|
|
44
102
|
requires: ["listbox.open"],
|
|
45
103
|
setup: [
|
|
46
|
-
{
|
|
104
|
+
{
|
|
105
|
+
when: ["pointer"],
|
|
106
|
+
steps: () => [
|
|
107
|
+
{ type: "click", target: "relative", relativeTarget: "first" }
|
|
108
|
+
]
|
|
109
|
+
}
|
|
47
110
|
],
|
|
48
|
-
assertion:
|
|
49
|
-
...isAriaSelected("first")
|
|
50
|
-
]
|
|
111
|
+
assertion: () => isAriaSelected("first")
|
|
51
112
|
},
|
|
52
113
|
"selectedOption.last": {
|
|
53
114
|
requires: ["listbox.open"],
|
|
54
115
|
setup: [
|
|
55
|
-
{
|
|
116
|
+
{
|
|
117
|
+
when: ["pointer"],
|
|
118
|
+
steps: () => [
|
|
119
|
+
{ type: "click", target: "relative", relativeTarget: "last" }
|
|
120
|
+
]
|
|
121
|
+
}
|
|
56
122
|
],
|
|
57
|
-
assertion:
|
|
58
|
-
...isAriaSelected("first")
|
|
59
|
-
]
|
|
123
|
+
assertion: () => isAriaSelected("last")
|
|
60
124
|
}
|
|
61
125
|
};
|
|
62
|
-
function openCombobox() {
|
|
63
|
-
return [
|
|
64
|
-
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
65
|
-
];
|
|
66
|
-
}
|
|
67
|
-
function closeCombobox() {
|
|
68
|
-
return [
|
|
69
|
-
{ type: "keypress", target: "input", key: "Escape" }
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
function focusInput() {
|
|
73
|
-
return [
|
|
74
|
-
{ type: "focus", target: "input" }
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
function fillInput() {
|
|
78
|
-
return [
|
|
79
|
-
{ type: "type", target: "input", value: "test" }
|
|
80
|
-
];
|
|
81
|
-
}
|
|
82
126
|
function isComboboxOpen() {
|
|
83
127
|
return [
|
|
84
128
|
{
|
|
85
129
|
target: "listbox",
|
|
86
130
|
assertion: "toBeVisible",
|
|
87
131
|
failureMessage: "Expected listbox to be visible"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
target: "input",
|
|
135
|
+
assertion: "toHaveAttribute",
|
|
136
|
+
attribute: "aria-expanded",
|
|
137
|
+
expectedValue: "true",
|
|
138
|
+
failureMessage: "Expect combobox input to have aria-expanded='true'"
|
|
88
139
|
}
|
|
89
140
|
];
|
|
90
141
|
}
|
|
@@ -94,6 +145,13 @@ function isComboboxClosed() {
|
|
|
94
145
|
target: "listbox",
|
|
95
146
|
assertion: "notToBeVisible",
|
|
96
147
|
failureMessage: "Expected listbox to be closed"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
target: "input",
|
|
151
|
+
assertion: "toHaveAttribute",
|
|
152
|
+
attribute: "aria-expanded",
|
|
153
|
+
expectedValue: "false",
|
|
154
|
+
failureMessage: "Expect combobox input to have aria-expanded='false'"
|
|
97
155
|
}
|
|
98
156
|
];
|
|
99
157
|
}
|
|
@@ -116,7 +174,7 @@ function isAriaSelected(index) {
|
|
|
116
174
|
assertion: "toHaveAttribute",
|
|
117
175
|
attribute: "aria-selected",
|
|
118
176
|
expectedValue: "true",
|
|
119
|
-
failureMessage: `Expected
|
|
177
|
+
failureMessage: `Expected ${index} option to have aria-selected='true'`
|
|
120
178
|
}
|
|
121
179
|
];
|
|
122
180
|
}
|
|
@@ -262,7 +320,17 @@ var DynamicTestBuilder = class {
|
|
|
262
320
|
return this.parent;
|
|
263
321
|
}
|
|
264
322
|
_finalize() {
|
|
265
|
-
const
|
|
323
|
+
const capabilityMap = {
|
|
324
|
+
keypress: "keyboard",
|
|
325
|
+
click: "pointer",
|
|
326
|
+
type: "textInput",
|
|
327
|
+
focus: "keyboard",
|
|
328
|
+
hover: "pointer"
|
|
329
|
+
// add more mappings as needed
|
|
330
|
+
};
|
|
331
|
+
const capability = capabilityMap[this._as || "keyboard"] || (this._as || "keyboard");
|
|
332
|
+
const ctx = { capabilities: [capability] };
|
|
333
|
+
const resolveAllSetups = (stateName, visited = /* @__PURE__ */ new Set()) => {
|
|
266
334
|
if (visited.has(stateName)) return [];
|
|
267
335
|
visited.add(stateName);
|
|
268
336
|
const s = this.statePack[stateName];
|
|
@@ -270,22 +338,30 @@ var DynamicTestBuilder = class {
|
|
|
270
338
|
let actions = [];
|
|
271
339
|
if (Array.isArray(s.requires)) {
|
|
272
340
|
for (const req of s.requires) {
|
|
273
|
-
actions = actions.concat(
|
|
341
|
+
actions = actions.concat(resolveAllSetups(req, visited));
|
|
274
342
|
}
|
|
275
343
|
}
|
|
276
|
-
if (s.setup) actions = actions.concat(s.setup);
|
|
344
|
+
if (s.setup) actions = actions.concat(resolveSetup(s.setup, ctx));
|
|
277
345
|
return actions;
|
|
278
346
|
};
|
|
279
347
|
const setup = [];
|
|
280
348
|
for (const state of this._given) {
|
|
281
|
-
setup.push(...
|
|
349
|
+
setup.push(...resolveAllSetups(state));
|
|
282
350
|
}
|
|
283
351
|
const assertions = [];
|
|
284
352
|
for (const state of this._then) {
|
|
285
353
|
const s = this.statePack[state];
|
|
286
|
-
if (s && s.assertion) {
|
|
287
|
-
|
|
288
|
-
|
|
354
|
+
if (s && s.assertion !== void 0) {
|
|
355
|
+
let value = s.assertion;
|
|
356
|
+
if (typeof value === "function") {
|
|
357
|
+
try {
|
|
358
|
+
value = value();
|
|
359
|
+
} catch (e) {
|
|
360
|
+
throw new Error(`Error calling assertion function for state '${state}': ${e.message}`);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
if (Array.isArray(value)) assertions.push(...value);
|
|
364
|
+
else assertions.push(value);
|
|
289
365
|
}
|
|
290
366
|
}
|
|
291
367
|
const action = [
|
|
@@ -1,88 +1,139 @@
|
|
|
1
1
|
// src/utils/test/dsl/src/state-packs/comboboxStatePack.ts
|
|
2
|
+
function hasCapabilities(ctx, requiredCaps) {
|
|
3
|
+
return requiredCaps.some((cap) => ctx.capabilities.includes(cap));
|
|
4
|
+
}
|
|
5
|
+
function resolveSetup(setup, ctx) {
|
|
6
|
+
if (Array.isArray(setup) && setup.length && !setup[0].when) {
|
|
7
|
+
setup = [{ when: ["keyboard"], steps: () => setup }];
|
|
8
|
+
}
|
|
9
|
+
for (const strat of setup) {
|
|
10
|
+
if (hasCapabilities(ctx, strat.when)) {
|
|
11
|
+
return strat.steps(ctx);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
throw new Error(
|
|
15
|
+
`No setup strategy matches capabilities: ${ctx.capabilities.join(", ")}`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
2
18
|
var COMBOBOX_STATES = {
|
|
3
19
|
"listbox.open": {
|
|
4
|
-
setup:
|
|
5
|
-
|
|
20
|
+
setup: [
|
|
21
|
+
{
|
|
22
|
+
when: ["keyboard", "textInput"],
|
|
23
|
+
steps: () => [
|
|
24
|
+
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
when: ["pointer"],
|
|
29
|
+
steps: () => [
|
|
30
|
+
{ type: "click", target: "button" }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
assertion: isComboboxOpen
|
|
6
35
|
},
|
|
7
36
|
"listbox.closed": {
|
|
8
|
-
setup:
|
|
9
|
-
|
|
37
|
+
setup: [
|
|
38
|
+
{
|
|
39
|
+
when: ["keyboard"],
|
|
40
|
+
steps: () => [
|
|
41
|
+
/* { type: "keypress", target: "input", key: "Escape" } */
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
when: ["pointer"],
|
|
46
|
+
steps: () => [
|
|
47
|
+
/* { type: "click", target: "button" } */
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
assertion: isComboboxClosed
|
|
10
52
|
},
|
|
11
53
|
"input.focused": {
|
|
12
|
-
setup:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
54
|
+
setup: [
|
|
55
|
+
{
|
|
56
|
+
when: ["keyboard"],
|
|
57
|
+
steps: () => [
|
|
58
|
+
{ type: "focus", target: "input" }
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
assertion: isInputFocused
|
|
16
63
|
},
|
|
17
64
|
"input.filled": {
|
|
18
|
-
setup:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
65
|
+
setup: [
|
|
66
|
+
{
|
|
67
|
+
when: ["keyboard", "textInput"],
|
|
68
|
+
steps: () => [
|
|
69
|
+
{ type: "type", target: "input", value: "test" }
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
assertion: isInputFilled
|
|
22
74
|
},
|
|
23
75
|
"activeOption.first": {
|
|
24
76
|
requires: ["listbox.open"],
|
|
25
77
|
setup: [
|
|
26
|
-
{
|
|
78
|
+
{
|
|
79
|
+
when: ["keyboard"],
|
|
80
|
+
steps: () => [
|
|
81
|
+
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
82
|
+
]
|
|
83
|
+
}
|
|
27
84
|
],
|
|
28
|
-
assertion:
|
|
29
|
-
...isActiveDescendantNotEmpty()
|
|
30
|
-
]
|
|
85
|
+
assertion: isActiveDescendantNotEmpty
|
|
31
86
|
},
|
|
32
87
|
"activeOption.last": {
|
|
33
88
|
requires: ["activeOption.first"],
|
|
34
89
|
setup: [
|
|
35
|
-
{
|
|
90
|
+
{
|
|
91
|
+
when: ["keyboard"],
|
|
92
|
+
steps: () => [
|
|
93
|
+
{ type: "keypress", target: "input", key: "ArrowUp" }
|
|
94
|
+
]
|
|
95
|
+
}
|
|
36
96
|
],
|
|
37
|
-
assertion:
|
|
38
|
-
...isActiveDescendantNotEmpty()
|
|
39
|
-
]
|
|
97
|
+
assertion: isActiveDescendantNotEmpty
|
|
40
98
|
},
|
|
41
99
|
"selectedOption.first": {
|
|
42
100
|
requires: ["listbox.open"],
|
|
43
101
|
setup: [
|
|
44
|
-
{
|
|
102
|
+
{
|
|
103
|
+
when: ["pointer"],
|
|
104
|
+
steps: () => [
|
|
105
|
+
{ type: "click", target: "relative", relativeTarget: "first" }
|
|
106
|
+
]
|
|
107
|
+
}
|
|
45
108
|
],
|
|
46
|
-
assertion:
|
|
47
|
-
...isAriaSelected("first")
|
|
48
|
-
]
|
|
109
|
+
assertion: () => isAriaSelected("first")
|
|
49
110
|
},
|
|
50
111
|
"selectedOption.last": {
|
|
51
112
|
requires: ["listbox.open"],
|
|
52
113
|
setup: [
|
|
53
|
-
{
|
|
114
|
+
{
|
|
115
|
+
when: ["pointer"],
|
|
116
|
+
steps: () => [
|
|
117
|
+
{ type: "click", target: "relative", relativeTarget: "last" }
|
|
118
|
+
]
|
|
119
|
+
}
|
|
54
120
|
],
|
|
55
|
-
assertion:
|
|
56
|
-
...isAriaSelected("first")
|
|
57
|
-
]
|
|
121
|
+
assertion: () => isAriaSelected("last")
|
|
58
122
|
}
|
|
59
123
|
};
|
|
60
|
-
function openCombobox() {
|
|
61
|
-
return [
|
|
62
|
-
{ type: "keypress", target: "input", key: "ArrowDown" }
|
|
63
|
-
];
|
|
64
|
-
}
|
|
65
|
-
function closeCombobox() {
|
|
66
|
-
return [
|
|
67
|
-
{ type: "keypress", target: "input", key: "Escape" }
|
|
68
|
-
];
|
|
69
|
-
}
|
|
70
|
-
function focusInput() {
|
|
71
|
-
return [
|
|
72
|
-
{ type: "focus", target: "input" }
|
|
73
|
-
];
|
|
74
|
-
}
|
|
75
|
-
function fillInput() {
|
|
76
|
-
return [
|
|
77
|
-
{ type: "type", target: "input", value: "test" }
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
124
|
function isComboboxOpen() {
|
|
81
125
|
return [
|
|
82
126
|
{
|
|
83
127
|
target: "listbox",
|
|
84
128
|
assertion: "toBeVisible",
|
|
85
129
|
failureMessage: "Expected listbox to be visible"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
target: "input",
|
|
133
|
+
assertion: "toHaveAttribute",
|
|
134
|
+
attribute: "aria-expanded",
|
|
135
|
+
expectedValue: "true",
|
|
136
|
+
failureMessage: "Expect combobox input to have aria-expanded='true'"
|
|
86
137
|
}
|
|
87
138
|
];
|
|
88
139
|
}
|
|
@@ -92,6 +143,13 @@ function isComboboxClosed() {
|
|
|
92
143
|
target: "listbox",
|
|
93
144
|
assertion: "notToBeVisible",
|
|
94
145
|
failureMessage: "Expected listbox to be closed"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
target: "input",
|
|
149
|
+
assertion: "toHaveAttribute",
|
|
150
|
+
attribute: "aria-expanded",
|
|
151
|
+
expectedValue: "false",
|
|
152
|
+
failureMessage: "Expect combobox input to have aria-expanded='false'"
|
|
95
153
|
}
|
|
96
154
|
];
|
|
97
155
|
}
|
|
@@ -114,7 +172,7 @@ function isAriaSelected(index) {
|
|
|
114
172
|
assertion: "toHaveAttribute",
|
|
115
173
|
attribute: "aria-selected",
|
|
116
174
|
expectedValue: "true",
|
|
117
|
-
failureMessage: `Expected
|
|
175
|
+
failureMessage: `Expected ${index} option to have aria-selected='true'`
|
|
118
176
|
}
|
|
119
177
|
];
|
|
120
178
|
}
|
|
@@ -260,7 +318,17 @@ var DynamicTestBuilder = class {
|
|
|
260
318
|
return this.parent;
|
|
261
319
|
}
|
|
262
320
|
_finalize() {
|
|
263
|
-
const
|
|
321
|
+
const capabilityMap = {
|
|
322
|
+
keypress: "keyboard",
|
|
323
|
+
click: "pointer",
|
|
324
|
+
type: "textInput",
|
|
325
|
+
focus: "keyboard",
|
|
326
|
+
hover: "pointer"
|
|
327
|
+
// add more mappings as needed
|
|
328
|
+
};
|
|
329
|
+
const capability = capabilityMap[this._as || "keyboard"] || (this._as || "keyboard");
|
|
330
|
+
const ctx = { capabilities: [capability] };
|
|
331
|
+
const resolveAllSetups = (stateName, visited = /* @__PURE__ */ new Set()) => {
|
|
264
332
|
if (visited.has(stateName)) return [];
|
|
265
333
|
visited.add(stateName);
|
|
266
334
|
const s = this.statePack[stateName];
|
|
@@ -268,22 +336,30 @@ var DynamicTestBuilder = class {
|
|
|
268
336
|
let actions = [];
|
|
269
337
|
if (Array.isArray(s.requires)) {
|
|
270
338
|
for (const req of s.requires) {
|
|
271
|
-
actions = actions.concat(
|
|
339
|
+
actions = actions.concat(resolveAllSetups(req, visited));
|
|
272
340
|
}
|
|
273
341
|
}
|
|
274
|
-
if (s.setup) actions = actions.concat(s.setup);
|
|
342
|
+
if (s.setup) actions = actions.concat(resolveSetup(s.setup, ctx));
|
|
275
343
|
return actions;
|
|
276
344
|
};
|
|
277
345
|
const setup = [];
|
|
278
346
|
for (const state of this._given) {
|
|
279
|
-
setup.push(...
|
|
347
|
+
setup.push(...resolveAllSetups(state));
|
|
280
348
|
}
|
|
281
349
|
const assertions = [];
|
|
282
350
|
for (const state of this._then) {
|
|
283
351
|
const s = this.statePack[state];
|
|
284
|
-
if (s && s.assertion) {
|
|
285
|
-
|
|
286
|
-
|
|
352
|
+
if (s && s.assertion !== void 0) {
|
|
353
|
+
let value = s.assertion;
|
|
354
|
+
if (typeof value === "function") {
|
|
355
|
+
try {
|
|
356
|
+
value = value();
|
|
357
|
+
} catch (e) {
|
|
358
|
+
throw new Error(`Error calling assertion function for state '${state}': ${e.message}`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (Array.isArray(value)) assertions.push(...value);
|
|
362
|
+
else assertions.push(value);
|
|
287
363
|
}
|
|
288
364
|
}
|
|
289
365
|
const action = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aria-ease",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.11.0",
|
|
4
4
|
"description": "Accessibility infrastructure for the entire frontend engineering lifecycle. Build accessible patterns, run automated audits, verify component interactions, and gate deployments — all in one system.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"release:patch": "standard-version --release-as patch",
|
|
17
17
|
"release:minor": "standard-version --release-as minor",
|
|
18
18
|
"release:major": "standard-version --release-as major",
|
|
19
|
-
"clean": "rm -rf dist
|
|
19
|
+
"clean": "rm -rf dist",
|
|
20
20
|
"build:core": "tsup ./index.ts --format esm,cjs --dts --outDir dist --external jest-axe --external @testing-library/react --external @axe-core/playwright --external playwright",
|
|
21
21
|
"build:modules": "tsup ./src/combobox/index.ts ./src/accordion/index.ts ./src/block/index.ts ./src/checkbox/index.ts ./src/menu/index.ts ./src/tabs/index.ts ./src/radio/index.ts ./src/toggle/index.ts ./src/contracts/index.ts --format esm,cjs --dts --treeshake --outDir dist/src",
|
|
22
22
|
"build:test": "tsup ./src/utils/test/index.ts --format esm,cjs --dts --treeshake --external jest-axe --external @testing-library/react --external playwright --external @playwright/test --outDir dist/src/utils/test",
|
|
23
23
|
"build:dsl": "tsup ./src/utils/test/dsl/index.ts --format esm,cjs --dts --treeshake --outDir dist/src/utils/test/dsl",
|
|
24
|
-
"build:cli": "tsup ./src/utils/cli/cli.ts --format esm,cjs --dts --outDir
|
|
24
|
+
"build:cli": "tsup ./src/utils/cli/cli.ts --format esm,cjs --dts --outDir dist --external commander --external chalk --external jest-axe --external @testing-library/react --external @axe-core/playwright --external playwright",
|
|
25
25
|
"build:contracts": "mkdir -p ./dist/src/utils/test && cp -r ./src/utils/test/contract/aria-contracts ./dist/src/utils/test/",
|
|
26
26
|
"build": "npm run clean && npm run build:core && npm run build:modules && npm run build:test && npm run build:dsl && npm run build:cli && npm run build:contracts"
|
|
27
27
|
},
|
|
@@ -127,7 +127,6 @@
|
|
|
127
127
|
},
|
|
128
128
|
"files": [
|
|
129
129
|
"dist",
|
|
130
|
-
"bin",
|
|
131
130
|
"README.md",
|
|
132
131
|
"LICENSE"
|
|
133
132
|
],
|
|
@@ -152,6 +151,6 @@
|
|
|
152
151
|
}
|
|
153
152
|
},
|
|
154
153
|
"bin": {
|
|
155
|
-
"aria-ease": "./
|
|
154
|
+
"aria-ease": "./dist/cli.js"
|
|
156
155
|
}
|
|
157
156
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
test_exports
|
|
3
|
-
} from "./chunk-PK5L2SAF.js";
|
|
4
|
-
import "./chunk-I2KLQ2HA.js";
|
|
5
|
-
|
|
6
|
-
// src/utils/test/src/component-strategies/AccordionComponentStrategy.ts
|
|
7
|
-
var AccordionComponentStrategy = class {
|
|
8
|
-
constructor(mainSelector, selectors, actionTimeoutMs = 400, assertionTimeoutMs = 400) {
|
|
9
|
-
this.mainSelector = mainSelector;
|
|
10
|
-
this.selectors = selectors;
|
|
11
|
-
this.actionTimeoutMs = actionTimeoutMs;
|
|
12
|
-
this.assertionTimeoutMs = assertionTimeoutMs;
|
|
13
|
-
}
|
|
14
|
-
async resetState(page) {
|
|
15
|
-
if (!this.selectors.panel || !this.selectors.trigger || this.selectors.popup) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const triggerSelector = this.selectors.trigger;
|
|
19
|
-
const panelSelector = this.selectors.panel;
|
|
20
|
-
if (!triggerSelector || !panelSelector) return;
|
|
21
|
-
const allTriggers = await page.locator(triggerSelector).all();
|
|
22
|
-
for (const trigger of allTriggers) {
|
|
23
|
-
const isExpanded = await trigger.getAttribute("aria-expanded") === "true";
|
|
24
|
-
const triggerPanel = await trigger.getAttribute("aria-controls");
|
|
25
|
-
if (isExpanded && triggerPanel) {
|
|
26
|
-
await trigger.click({ timeout: this.actionTimeoutMs });
|
|
27
|
-
const panel = page.locator(`#${triggerPanel}`);
|
|
28
|
-
await (0, test_exports.expect)(panel).toBeHidden({ timeout: this.assertionTimeoutMs }).catch(() => {
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
async shouldSkipTest() {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
getMainSelector() {
|
|
37
|
-
return this.mainSelector;
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
export {
|
|
41
|
-
AccordionComponentStrategy
|
|
42
|
-
};
|