aria-ease 2.8.0 → 2.8.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.
- package/bin/cli.js +3 -4
- package/dist/chunk-PCORWVIQ.js +213 -0
- package/dist/{chunk-4F6O5RKZ.js → chunk-SSBW5VAA.js} +0 -1
- package/dist/{contractTestRunnerPlaywright-FM6MK6DY.js → contractTestRunnerPlaywright-SE6TPWZZ.js} +1 -2
- package/{bin/contractTestRunnerPlaywright-2LQHVMXT.js → dist/contractTestRunnerPlaywright-YNHMLHQ2.js} +6 -178
- package/dist/contractTestRunnerPlaywright-ZY2T4UTV.js +254 -0
- package/dist/index.cjs +23 -8
- package/dist/index.d.cts +11 -14
- package/dist/index.d.ts +11 -14
- package/dist/index.js +24 -9
- package/dist/src/{Types.d-BbztRe-S.d.cts → Types.d-w1KLKLcA.d.cts} +8 -1
- package/dist/src/{Types.d-BbztRe-S.d.ts → Types.d-w1KLKLcA.d.ts} +8 -1
- package/dist/src/accordion/index.cjs +0 -2
- package/dist/src/accordion/index.d.cts +1 -1
- package/dist/src/accordion/index.d.ts +1 -1
- package/dist/src/accordion/index.js +0 -2
- package/dist/src/block/index.cjs +13 -5
- package/dist/src/block/index.d.cts +4 -3
- package/dist/src/block/index.d.ts +4 -3
- package/dist/src/block/index.js +14 -6
- package/dist/src/checkbox/index.cjs +0 -2
- package/dist/src/checkbox/index.d.cts +1 -1
- package/dist/src/checkbox/index.d.ts +1 -1
- package/dist/src/checkbox/index.js +0 -2
- package/dist/src/{chunk-DF4OR64G.js → chunk-TBJ6MIC7.js} +0 -2
- package/dist/src/menu/index.cjs +9 -4
- package/dist/src/menu/index.d.cts +4 -11
- package/dist/src/menu/index.d.ts +4 -11
- package/dist/src/menu/index.js +10 -5
- package/dist/src/radio/index.cjs +0 -2
- package/dist/src/radio/index.d.cts +1 -1
- package/dist/src/radio/index.d.ts +1 -1
- package/dist/src/radio/index.js +0 -2
- package/dist/src/toggle/index.cjs +0 -2
- package/dist/src/toggle/index.d.cts +1 -1
- package/dist/src/toggle/index.d.ts +1 -1
- package/dist/src/toggle/index.js +0 -2
- package/dist/src/utils/test/{chunk-UAS6V5MH.js → chunk-SSBW5VAA.js} +0 -2
- package/dist/src/utils/test/{contractTestRunnerPlaywright-IBC4FHWK.js → contractTestRunnerPlaywright-I36Y2NHA.js} +1 -3
- package/dist/src/utils/test/contractTestRunnerPlaywright-YNHMLHQ2.js +249 -0
- package/dist/src/utils/test/contractTestRunnerPlaywright-ZY2T4UTV.js +249 -0
- package/dist/src/utils/test/contracts/MenuContract.json +52 -8
- package/dist/src/utils/test/index.cjs +1 -3
- package/dist/src/utils/test/index.js +2 -4
- package/package.json +14 -13
- package/bin/cli.cjs +0 -475
- package/bin/cli.cjs.map +0 -1
- package/bin/cli.d.cts +0 -1
- package/bin/cli.d.ts +0 -1
- package/bin/cli.d.ts.map +0 -1
- package/bin/cli.js.map +0 -1
- package/bin/cli.ts +0 -122
- package/bin/configLoader.d.ts +0 -19
- package/bin/configLoader.d.ts.map +0 -1
- package/bin/configLoader.js +0 -155
- package/bin/configLoader.ts +0 -170
- package/bin/contractTestRunnerPlaywright-2LQHVMXT.js.map +0 -1
- package/dist/chunk-4F6O5RKZ.js.map +0 -1
- package/dist/contractTestRunnerPlaywright-FM6MK6DY.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/src/accordion/index.cjs.map +0 -1
- package/dist/src/accordion/index.js.map +0 -1
- package/dist/src/block/index.cjs.map +0 -1
- package/dist/src/block/index.js.map +0 -1
- package/dist/src/checkbox/index.cjs.map +0 -1
- package/dist/src/checkbox/index.js.map +0 -1
- package/dist/src/chunk-CGC24XEF.js +0 -127
- package/dist/src/chunk-CGC24XEF.js.map +0 -1
- package/dist/src/chunk-DF4OR64G.js.map +0 -1
- package/dist/src/chunk-MNMWQWXH.js +0 -117
- package/dist/src/chunk-MNMWQWXH.js.map +0 -1
- package/dist/src/menu/index.cjs.map +0 -1
- package/dist/src/menu/index.js.map +0 -1
- package/dist/src/radio/index.cjs.map +0 -1
- package/dist/src/radio/index.js.map +0 -1
- package/dist/src/toggle/index.cjs.map +0 -1
- package/dist/src/toggle/index.js.map +0 -1
- package/dist/src/utils/test/chunk-UAS6V5MH.js.map +0 -1
- package/dist/src/utils/test/contractTestRunnerPlaywright-IBC4FHWK.js.map +0 -1
- package/dist/src/utils/test/index.cjs.map +0 -1
- package/dist/src/utils/test/index.js.map +0 -1
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { ContractReporter, contract_default } from './chunk-SSBW5VAA.js';
|
|
2
|
+
import { chromium } from 'playwright';
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
|
|
5
|
+
async function runContractTestsPlaywright(componentName, url) {
|
|
6
|
+
const reporter = new ContractReporter(true);
|
|
7
|
+
const contractTyped = contract_default;
|
|
8
|
+
const contractPath = contractTyped[componentName]?.path;
|
|
9
|
+
if (!contractPath) {
|
|
10
|
+
throw new Error(`Contract path not found for component: ${componentName}`);
|
|
11
|
+
}
|
|
12
|
+
const resolvedPath = new URL(contractPath, import.meta.url).pathname;
|
|
13
|
+
const contractData = readFileSync(resolvedPath, "utf-8");
|
|
14
|
+
const componentContract = JSON.parse(contractData);
|
|
15
|
+
const totalTests = componentContract.static[0].assertions.length + componentContract.dynamic.length;
|
|
16
|
+
reporter.start(componentName, totalTests);
|
|
17
|
+
const failures = [];
|
|
18
|
+
const passes = [];
|
|
19
|
+
let browser = null;
|
|
20
|
+
try {
|
|
21
|
+
browser = await chromium.launch({ headless: true });
|
|
22
|
+
const context = await browser.newContext();
|
|
23
|
+
const page = await context.newPage();
|
|
24
|
+
await page.goto(url, { waitUntil: "networkidle" });
|
|
25
|
+
await page.waitForSelector(componentContract.selectors.trigger, { timeout: 9e4 });
|
|
26
|
+
async function resolveRelativeTarget(selector, relative) {
|
|
27
|
+
const items = await page.locator(selector).all();
|
|
28
|
+
switch (relative) {
|
|
29
|
+
case "first":
|
|
30
|
+
return items[0];
|
|
31
|
+
case "second":
|
|
32
|
+
return items[1];
|
|
33
|
+
case "last":
|
|
34
|
+
return items[items.length - 1];
|
|
35
|
+
case "next": {
|
|
36
|
+
const currentIndex = await page.evaluate(([sel]) => {
|
|
37
|
+
const items2 = Array.from(document.querySelectorAll(sel));
|
|
38
|
+
return items2.indexOf(document.activeElement);
|
|
39
|
+
}, [selector]);
|
|
40
|
+
const nextIndex = (currentIndex + 1) % items.length;
|
|
41
|
+
return items[nextIndex];
|
|
42
|
+
}
|
|
43
|
+
case "previous": {
|
|
44
|
+
const currentIndex = await page.evaluate(([sel]) => {
|
|
45
|
+
const items2 = Array.from(document.querySelectorAll(sel));
|
|
46
|
+
return items2.indexOf(document.activeElement);
|
|
47
|
+
}, [selector]);
|
|
48
|
+
const prevIndex = (currentIndex - 1 + items.length) % items.length;
|
|
49
|
+
return items[prevIndex];
|
|
50
|
+
}
|
|
51
|
+
default:
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
for (const test of componentContract.static[0]?.assertions || []) {
|
|
56
|
+
if (test.target === "relative") continue;
|
|
57
|
+
const targetSelector = componentContract.selectors[test.target];
|
|
58
|
+
if (!targetSelector) {
|
|
59
|
+
failures.push(`Selector for target ${test.target} not found.`);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const target = page.locator(targetSelector).first();
|
|
63
|
+
const exists = await target.count() > 0;
|
|
64
|
+
if (!exists) {
|
|
65
|
+
failures.push(`Target ${test.target} not found.`);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (!test.expectedValue) {
|
|
69
|
+
const attributes = test.attribute.split(" | ");
|
|
70
|
+
let hasAny = false;
|
|
71
|
+
for (const attr of attributes) {
|
|
72
|
+
const value = await target.getAttribute(attr.trim());
|
|
73
|
+
if (value !== null) {
|
|
74
|
+
hasAny = true;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (!hasAny) {
|
|
79
|
+
failures.push(test.failureMessage + ` None of the attributes "${test.attribute}" are present.`);
|
|
80
|
+
} else {
|
|
81
|
+
passes.push(`At least one of the attributes "${test.attribute}" exists on the element.`);
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
const attributeValue = await target.getAttribute(test.attribute);
|
|
85
|
+
const expectedValues = test.expectedValue.split(" | ");
|
|
86
|
+
if (!attributeValue || !expectedValues.includes(attributeValue)) {
|
|
87
|
+
failures.push(test.failureMessage + ` Attribute value does not match expected value. Expected: ${test.expectedValue}, Found: ${attributeValue}`);
|
|
88
|
+
} else {
|
|
89
|
+
passes.push(`Attribute value matches expected value. Expected: ${test.expectedValue}, Found: ${attributeValue}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
for (const dynamicTest of componentContract.dynamic || []) {
|
|
94
|
+
const { action, assertions } = dynamicTest;
|
|
95
|
+
const failuresBeforeTest = failures.length;
|
|
96
|
+
const containerElement = page.locator(componentContract.selectors.container).first();
|
|
97
|
+
const triggerElement = page.locator(componentContract.selectors.trigger).first();
|
|
98
|
+
const isContainerVisible = await containerElement.isVisible();
|
|
99
|
+
if (isContainerVisible) {
|
|
100
|
+
await triggerElement.click();
|
|
101
|
+
await page.waitForTimeout(50);
|
|
102
|
+
}
|
|
103
|
+
for (const act of action) {
|
|
104
|
+
if (act.type === "click") {
|
|
105
|
+
if (act.target === "document") {
|
|
106
|
+
await page.mouse.click(10, 10);
|
|
107
|
+
} else {
|
|
108
|
+
const actionSelector = componentContract.selectors[act.target];
|
|
109
|
+
if (!actionSelector) {
|
|
110
|
+
failures.push(`Selector for action target ${act.target} not found.`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
await page.locator(actionSelector).first().click();
|
|
114
|
+
await page.waitForTimeout(200);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
if (act.type === "keypress" && act.key) {
|
|
118
|
+
const keyMap = {
|
|
119
|
+
"Space": "Space",
|
|
120
|
+
"Enter": "Enter",
|
|
121
|
+
"Escape": "Escape",
|
|
122
|
+
"Arrow Up": "ArrowUp",
|
|
123
|
+
"Arrow Down": "ArrowDown",
|
|
124
|
+
"Arrow Left": "ArrowLeft",
|
|
125
|
+
"Arrow Right": "ArrowRight",
|
|
126
|
+
"Home": "Home",
|
|
127
|
+
"End": "End",
|
|
128
|
+
"Tab": "Tab"
|
|
129
|
+
};
|
|
130
|
+
let keyValue = keyMap[act.key] || act.key;
|
|
131
|
+
if (keyValue === "Space") {
|
|
132
|
+
keyValue = " ";
|
|
133
|
+
} else if (keyValue.includes(" ")) {
|
|
134
|
+
keyValue = keyValue.replace(/ /g, "");
|
|
135
|
+
}
|
|
136
|
+
if (act.target === "focusable" && ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Escape"].includes(keyValue)) {
|
|
137
|
+
await page.waitForTimeout(100);
|
|
138
|
+
await page.keyboard.press(keyValue);
|
|
139
|
+
await page.waitForTimeout(50);
|
|
140
|
+
} else {
|
|
141
|
+
const keypressSelector = componentContract.selectors[act.target];
|
|
142
|
+
if (!keypressSelector) {
|
|
143
|
+
failures.push(`Selector for keypress target ${act.target} not found.`);
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
const target = page.locator(keypressSelector).first();
|
|
147
|
+
await target.press(keyValue);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
await page.waitForTimeout(100);
|
|
151
|
+
}
|
|
152
|
+
for (const assertion of assertions) {
|
|
153
|
+
let target;
|
|
154
|
+
if (assertion.target === "relative") {
|
|
155
|
+
const relativeSelector = componentContract.selectors.relative;
|
|
156
|
+
if (!relativeSelector) {
|
|
157
|
+
failures.push("Relative selector is not defined in the contract.");
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (!assertion.expectedValue) {
|
|
161
|
+
failures.push("Expected value for relative target is not defined.");
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
target = await resolveRelativeTarget(relativeSelector, assertion.expectedValue);
|
|
165
|
+
} else {
|
|
166
|
+
const assertionSelector = componentContract.selectors[assertion.target];
|
|
167
|
+
if (!assertionSelector) {
|
|
168
|
+
failures.push(`Selector for assertion target ${assertion.target} not found.`);
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
target = page.locator(assertionSelector).first();
|
|
172
|
+
}
|
|
173
|
+
if (!target) {
|
|
174
|
+
failures.push(`Target ${assertion.target} not found.`);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
if (assertion.assertion === "toBeVisible") {
|
|
178
|
+
const isVisible = await target.isVisible();
|
|
179
|
+
if (isVisible) {
|
|
180
|
+
passes.push(`${assertion.target} is visible as expected. Test: "${dynamicTest.description}".`);
|
|
181
|
+
} else {
|
|
182
|
+
failures.push(`${assertion.failureMessage}`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
if (assertion.assertion === "notToBeVisible") {
|
|
186
|
+
const isVisible = await target.isVisible();
|
|
187
|
+
if (!isVisible) {
|
|
188
|
+
passes.push(`${assertion.target} is not visible as expected. Test: "${dynamicTest.description}".`);
|
|
189
|
+
} else {
|
|
190
|
+
failures.push(assertion.failureMessage + ` ${assertion.target} is still visible.`);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
if (assertion.assertion === "toHaveAttribute" && assertion.attribute && assertion.expectedValue) {
|
|
194
|
+
const attributeValue = await target.getAttribute(assertion.attribute);
|
|
195
|
+
if (attributeValue === assertion.expectedValue) {
|
|
196
|
+
passes.push(`${assertion.target} has expected "${assertion.attribute}". Test: "${dynamicTest.description}".`);
|
|
197
|
+
} else {
|
|
198
|
+
failures.push(assertion.failureMessage + ` ${assertion.target} "${assertion.attribute}" should be "${assertion.expectedValue}", found "${attributeValue}".`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (assertion.assertion === "toHaveFocus") {
|
|
202
|
+
const hasFocus = await target.evaluate((el) => el === document.activeElement);
|
|
203
|
+
if (hasFocus) {
|
|
204
|
+
passes.push(`${assertion.target} has focus as expected. Test: "${dynamicTest.description}".`);
|
|
205
|
+
} else {
|
|
206
|
+
failures.push(`${assertion.failureMessage}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (assertion.assertion === "toHaveRole" && assertion.expectedValue) {
|
|
210
|
+
const roleValue = await target.getAttribute("role");
|
|
211
|
+
if (roleValue === assertion.expectedValue) {
|
|
212
|
+
passes.push(`${assertion.target} has role "${assertion.expectedValue}". Test: "${dynamicTest.description}".`);
|
|
213
|
+
} else {
|
|
214
|
+
failures.push(assertion.failureMessage + ` Expected role "${assertion.expectedValue}", found "${roleValue}".`);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const failuresAfterTest = failures.length;
|
|
219
|
+
const testPassed = failuresAfterTest === failuresBeforeTest;
|
|
220
|
+
const failureMessage = testPassed ? void 0 : failures[failures.length - 1];
|
|
221
|
+
reporter.reportTest(dynamicTest, testPassed ? "pass" : "fail", failureMessage);
|
|
222
|
+
}
|
|
223
|
+
const staticPassed = componentContract.static[0].assertions.length;
|
|
224
|
+
const staticFailed = 0;
|
|
225
|
+
reporter.reportStatic(staticPassed, staticFailed);
|
|
226
|
+
reporter.summary(failures);
|
|
227
|
+
} catch (error) {
|
|
228
|
+
if (error instanceof Error) {
|
|
229
|
+
if (error.message.includes("Executable doesn't exist")) {
|
|
230
|
+
console.error("\n\u274C Playwright browsers not found!\n");
|
|
231
|
+
console.log("\u{1F4E6} Run: npx playwright install chromium\n");
|
|
232
|
+
failures.push("Playwright browser not installed. Run: npx playwright install chromium");
|
|
233
|
+
} else if (error.message.includes("net::ERR_CONNECTION_REFUSED")) {
|
|
234
|
+
console.error("\n\u274C Cannot connect to dev server!\n");
|
|
235
|
+
console.log(` Make sure your dev server is running at ${url}
|
|
236
|
+
`);
|
|
237
|
+
failures.push(`Dev server not running at ${url}`);
|
|
238
|
+
} else {
|
|
239
|
+
console.error("\u274C Playwright test error:", error.message);
|
|
240
|
+
failures.push(`Test error: ${error.message}`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
} finally {
|
|
244
|
+
if (browser) await browser.close();
|
|
245
|
+
}
|
|
246
|
+
return { passes, failures };
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export { runContractTestsPlaywright };
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
{
|
|
70
70
|
"target": "container",
|
|
71
71
|
"assertion": "toBeVisible",
|
|
72
|
-
"failureMessage": "
|
|
72
|
+
"failureMessage": "Menu should be visible after clicking the trigger."
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
"target": "trigger",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
{
|
|
97
97
|
"target": "container",
|
|
98
98
|
"assertion": "notToBeVisible",
|
|
99
|
-
"failureMessage": "
|
|
99
|
+
"failureMessage": "Menu should not be visible after clicking the trigger twice."
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
102
|
"target": "trigger",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
{
|
|
122
122
|
"target": "container",
|
|
123
123
|
"assertion": "toBeVisible",
|
|
124
|
-
"failureMessage": "
|
|
124
|
+
"failureMessage": "Menu should be visible after pressing Enter on trigger."
|
|
125
125
|
},
|
|
126
126
|
{
|
|
127
127
|
"target": "trigger",
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
{
|
|
148
148
|
"target": "container",
|
|
149
149
|
"assertion": "toBeVisible",
|
|
150
|
-
"failureMessage": "
|
|
150
|
+
"failureMessage": "Menu should be visible after pressing Space on trigger."
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
153
|
"target": "trigger",
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
{
|
|
241
241
|
"target": "container",
|
|
242
242
|
"assertion": "notToBeVisible",
|
|
243
|
-
"failureMessage": "
|
|
243
|
+
"failureMessage": "Menu should close after pressing Escape."
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
246
|
"target": "trigger",
|
|
@@ -266,7 +266,7 @@
|
|
|
266
266
|
{
|
|
267
267
|
"target": "container",
|
|
268
268
|
"assertion": "notToBeVisible",
|
|
269
|
-
"failureMessage": "
|
|
269
|
+
"failureMessage": "Menu should close after pressing Enter on trigger when menu is open."
|
|
270
270
|
},
|
|
271
271
|
{
|
|
272
272
|
"target": "trigger",
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
{
|
|
288
288
|
"target": "container",
|
|
289
289
|
"assertion": "notToBeVisible",
|
|
290
|
-
"failureMessage": "
|
|
290
|
+
"failureMessage": "Menu should close after pressing Space on trigger when menu is open."
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
293
|
"target": "trigger",
|
|
@@ -308,7 +308,7 @@
|
|
|
308
308
|
{
|
|
309
309
|
"target": "container",
|
|
310
310
|
"assertion": "notToBeVisible",
|
|
311
|
-
"failureMessage": "
|
|
311
|
+
"failureMessage": "Menu should close after clicking outside."
|
|
312
312
|
},
|
|
313
313
|
{
|
|
314
314
|
"target": "trigger",
|
|
@@ -338,6 +338,50 @@
|
|
|
338
338
|
"failureMessage": "Submenu should open when Right arrow pressed on item with submenu"
|
|
339
339
|
}
|
|
340
340
|
]
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"description": "Tab on a menuitem closes the menu and update aria-expanded",
|
|
344
|
+
"requiresBrowser": true,
|
|
345
|
+
"action": [
|
|
346
|
+
{ "type": "click", "target": "trigger" },
|
|
347
|
+
{ "type": "keypress", "target": "focusable", "key": "Tab" }
|
|
348
|
+
],
|
|
349
|
+
"assertions": [
|
|
350
|
+
{
|
|
351
|
+
"target": "container",
|
|
352
|
+
"assertion": "notToBeVisible",
|
|
353
|
+
"failureMessage": "Menu should close after clicking outside."
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"target": "trigger",
|
|
357
|
+
"assertion": "toHaveAttribute",
|
|
358
|
+
"attribute": "aria-expanded",
|
|
359
|
+
"expectedValue": "false",
|
|
360
|
+
"failureMessage": "Trigger's aria-expanded should be false after Tab key closes the menu."
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
"description": "Shift+Tab on a menuitem closes the menu and update aria-expanded",
|
|
366
|
+
"requiresBrowser": true,
|
|
367
|
+
"action": [
|
|
368
|
+
{ "type": "click", "target": "trigger" },
|
|
369
|
+
{ "type": "keypress", "target": "focusable", "key": "Shift+Tab" }
|
|
370
|
+
],
|
|
371
|
+
"assertions": [
|
|
372
|
+
{
|
|
373
|
+
"target": "container",
|
|
374
|
+
"assertion": "notToBeVisible",
|
|
375
|
+
"failureMessage": "Menu should close after clicking outside."
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"target": "trigger",
|
|
379
|
+
"assertion": "toHaveAttribute",
|
|
380
|
+
"attribute": "aria-expanded",
|
|
381
|
+
"expectedValue": "false",
|
|
382
|
+
"failureMessage": "Trigger's aria-expanded should be false after Shift+Tab key closes the menu."
|
|
383
|
+
}
|
|
384
|
+
]
|
|
341
385
|
}
|
|
342
386
|
]
|
|
343
387
|
}
|
|
@@ -9258,7 +9258,7 @@ async function runContractTestsPlaywright(componentName, url) {
|
|
|
9258
9258
|
const context = await browser.newContext();
|
|
9259
9259
|
const page = await context.newPage();
|
|
9260
9260
|
await page.goto(url, { waitUntil: "networkidle" });
|
|
9261
|
-
await page.waitForSelector(componentContract.selectors.trigger, { timeout:
|
|
9261
|
+
await page.waitForSelector(componentContract.selectors.trigger, { timeout: 3e4 });
|
|
9262
9262
|
async function resolveRelativeTarget(selector, relative) {
|
|
9263
9263
|
const items = await page.locator(selector).all();
|
|
9264
9264
|
switch (relative) {
|
|
@@ -13088,5 +13088,3 @@ react-is/cjs/react-is.development.js:
|
|
|
13088
13088
|
*/
|
|
13089
13089
|
|
|
13090
13090
|
exports.testUiComponent = testUiComponent;
|
|
13091
|
-
//# sourceMappingURL=index.cjs.map
|
|
13092
|
-
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __commonJS, __toESM, ContractReporter, contract_default } from './chunk-
|
|
1
|
+
import { __commonJS, __toESM, ContractReporter, contract_default } from './chunk-SSBW5VAA.js';
|
|
2
2
|
import { axe } from 'jest-axe';
|
|
3
3
|
import fs from 'fs/promises';
|
|
4
4
|
|
|
@@ -12524,7 +12524,7 @@ async function testUiComponent(componentName, component, url) {
|
|
|
12524
12524
|
let contract;
|
|
12525
12525
|
if (url) {
|
|
12526
12526
|
console.log(`\u{1F3AD} Running Playwright E2E tests on ${url}`);
|
|
12527
|
-
const { runContractTestsPlaywright } = await import('./contractTestRunnerPlaywright-
|
|
12527
|
+
const { runContractTestsPlaywright } = await import('./contractTestRunnerPlaywright-YNHMLHQ2.js');
|
|
12528
12528
|
contract = await runContractTestsPlaywright(componentName, url);
|
|
12529
12529
|
} else {
|
|
12530
12530
|
console.log(`\u{1F9EA} Running jsdom tests (limited event handling)`);
|
|
@@ -12604,5 +12604,3 @@ react-is/cjs/react-is.development.js:
|
|
|
12604
12604
|
*/
|
|
12605
12605
|
|
|
12606
12606
|
export { runTest, testUiComponent };
|
|
12607
|
-
//# sourceMappingURL=index.js.map
|
|
12608
|
-
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aria-ease",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.2",
|
|
4
4
|
"description": "Out-of-the-box accessibility utility package to develop production ready applications.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"type": "module",
|
|
@@ -16,10 +16,10 @@
|
|
|
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
|
-
"build:core": "tsup ./index.ts --format esm,cjs --dts --
|
|
20
|
-
"build:modules": "tsup ./src/accordion/index.ts ./src/block/index.ts ./src/checkbox/index.ts ./src/menu/index.ts ./src/radio/index.ts ./src/toggle/index.ts --format esm,cjs --dts --treeshake --
|
|
21
|
-
"build:test": "tsup ./src/utils/test/index.ts --format esm,cjs --dts --treeshake --
|
|
22
|
-
"build:cli": "tsup ./
|
|
19
|
+
"build:core": "tsup ./index.ts --format esm,cjs --dts --outDir dist --external jest-axe --external @testing-library/react --external @axe-core/playwright --external playwright",
|
|
20
|
+
"build:modules": "tsup ./src/accordion/index.ts ./src/block/index.ts ./src/checkbox/index.ts ./src/menu/index.ts ./src/radio/index.ts ./src/toggle/index.ts --format esm,cjs --dts --treeshake --outDir dist/src",
|
|
21
|
+
"build:test": "tsup ./src/utils/test/index.ts --format esm,cjs --dts --treeshake --external jest-axe --external @testing-library/react --outDir dist/src/utils/test",
|
|
22
|
+
"build:cli": "tsup ./src/utils/cli/cli.ts --format esm,cjs --dts --outDir bin --external commander --external chalk --external jest-axe --external @testing-library/react --external @axe-core/playwright --external playwright",
|
|
23
23
|
"build:contracts": "mkdir -p ./dist/src/utils/test && cp -r ./src/utils/test/contract/contracts ./dist/src/utils/test/",
|
|
24
24
|
"build": "npm run build:core && npm run build:modules && npm run build:test && npm run build:cli && npm run build:contracts"
|
|
25
25
|
},
|
|
@@ -59,7 +59,9 @@
|
|
|
59
59
|
"tsup": "^8.5.0",
|
|
60
60
|
"typescript": "^5.9.2",
|
|
61
61
|
"vite": "^7.2.6",
|
|
62
|
-
"vitest": "^4.0.15"
|
|
62
|
+
"vitest": "^4.0.15",
|
|
63
|
+
"@testing-library/react": "^16.3.0",
|
|
64
|
+
"jest-axe": "^10.0.0"
|
|
63
65
|
},
|
|
64
66
|
"sideEffects": false,
|
|
65
67
|
"exports": {
|
|
@@ -105,17 +107,16 @@
|
|
|
105
107
|
},
|
|
106
108
|
"files": [
|
|
107
109
|
"dist",
|
|
108
|
-
"
|
|
110
|
+
"README.md",
|
|
111
|
+
"LICENSE"
|
|
109
112
|
],
|
|
113
|
+
"publishConfig": {
|
|
114
|
+
"access": "public"
|
|
115
|
+
},
|
|
110
116
|
"dependencies": {
|
|
111
|
-
"@axe-core/playwright": "^4.10.2",
|
|
112
|
-
"@testing-library/react": "^16.3.0",
|
|
113
117
|
"chalk": "^5.6.2",
|
|
114
118
|
"commander": "^14.0.1",
|
|
115
|
-
"fs-extra": "^11.3.2"
|
|
116
|
-
"jest-axe": "^10.0.0",
|
|
117
|
-
"playwright": "^1.55.1",
|
|
118
|
-
"typescript-eslint": "^8.41.0"
|
|
119
|
+
"fs-extra": "^11.3.2"
|
|
119
120
|
},
|
|
120
121
|
"peerDependencies": {
|
|
121
122
|
"@axe-core/playwright": "^4.10.2",
|