@warp-ds/elements 2.6.0-next.5 → 2.6.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/dist/custom-elements.json +4 -2
- package/dist/packages/pagination/pagination.a11y.test.d.ts +1 -0
- package/dist/packages/pagination/pagination.a11y.test.js +36 -0
- package/dist/packages/step-indicator/step-indicator.a11y.test.d.ts +2 -0
- package/dist/packages/step-indicator/step-indicator.a11y.test.js +66 -0
- package/dist/packages/textarea/textarea.a11y.test.d.ts +1 -0
- package/dist/packages/textarea/textarea.a11y.test.js +115 -0
- package/dist/packages/textarea/textarea.js +5 -5
- package/dist/packages/textarea/textarea.js.map +3 -3
- package/dist/packages/textarea/textarea.test.js +3 -1
- package/dist/setup-tests.d.ts +10 -0
- package/dist/setup-tests.js +61 -0
- package/dist/web-types.json +1 -1
- package/package.json +2 -1
|
@@ -166,7 +166,9 @@ test('restores original help text when validation passes', async () => {
|
|
|
166
166
|
await expect.poll(() => wTextArea.helpText).not.toBe('Enter your message');
|
|
167
167
|
// Fill in a value
|
|
168
168
|
await textarea.fill('Hello');
|
|
169
|
-
//
|
|
169
|
+
// Wait for value + validity to update, then restore original help text
|
|
170
|
+
await expect.poll(() => wTextArea.value).toBe('Hello');
|
|
171
|
+
await expect.poll(() => wTextArea.checkValidity()).toBe(true);
|
|
170
172
|
await expect.poll(() => wTextArea.invalid).toBe(false);
|
|
171
173
|
await expect.poll(() => wTextArea.helpText).toBe('Enter your message');
|
|
172
174
|
});
|
package/dist/setup-tests.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
1
|
import 'vitest-browser-lit';
|
|
2
|
+
interface AxeMatchers {
|
|
3
|
+
toHaveNoAxeViolations(): Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
declare module 'vitest' {
|
|
6
|
+
interface Assertion extends AxeMatchers {
|
|
7
|
+
}
|
|
8
|
+
interface AsymmetricMatchersContaining extends AxeMatchers {
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {};
|
package/dist/setup-tests.js
CHANGED
|
@@ -1 +1,62 @@
|
|
|
1
1
|
import 'vitest-browser-lit';
|
|
2
|
+
import axe from 'axe-core';
|
|
3
|
+
import { expect } from 'vitest';
|
|
4
|
+
function formatViolations(violations) {
|
|
5
|
+
if (violations.length === 0) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
return violations
|
|
9
|
+
.map((violation) => {
|
|
10
|
+
const nodeInfo = violation.nodes
|
|
11
|
+
.map((node) => {
|
|
12
|
+
const selector = node.target.join(', ');
|
|
13
|
+
return ` - Element: ${selector}\n HTML: ${node.html}\n ${node.failureSummary}`;
|
|
14
|
+
})
|
|
15
|
+
.join('\n');
|
|
16
|
+
return `${violation.id}: ${violation.help}\n Impact: ${violation.impact}\n Help URL: ${violation.helpUrl}\n${nodeInfo}`;
|
|
17
|
+
})
|
|
18
|
+
.join('\n\n');
|
|
19
|
+
}
|
|
20
|
+
async function runAxe(container = document.body) {
|
|
21
|
+
return axe.run(container, {
|
|
22
|
+
runOnly: {
|
|
23
|
+
type: 'tag',
|
|
24
|
+
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag22aa'],
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
function resolveAxeContainer(received) {
|
|
29
|
+
if (received && typeof received === 'object' && 'container' in received) {
|
|
30
|
+
const { container } = received;
|
|
31
|
+
if (container instanceof Element)
|
|
32
|
+
return container;
|
|
33
|
+
}
|
|
34
|
+
if (received instanceof Element) {
|
|
35
|
+
return received;
|
|
36
|
+
}
|
|
37
|
+
if (received instanceof Document) {
|
|
38
|
+
return received.body;
|
|
39
|
+
}
|
|
40
|
+
return document.body;
|
|
41
|
+
}
|
|
42
|
+
function toHaveNoViolations(results) {
|
|
43
|
+
if (typeof results.violations === 'undefined') {
|
|
44
|
+
throw new Error('No axe-core results found, unable to assert');
|
|
45
|
+
}
|
|
46
|
+
const violations = results.violations;
|
|
47
|
+
const pass = violations.length === 0;
|
|
48
|
+
return {
|
|
49
|
+
pass,
|
|
50
|
+
message: () => pass
|
|
51
|
+
? 'Expected to have accessibility violations, but none were found'
|
|
52
|
+
: `Expected no accessibility violations, but found ${violations.length}:\n\n${formatViolations(violations)}`,
|
|
53
|
+
actual: violations,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
expect.extend({
|
|
57
|
+
async toHaveNoAxeViolations(received) {
|
|
58
|
+
const container = resolveAxeContainer(received);
|
|
59
|
+
const results = await runAxe(container);
|
|
60
|
+
return toHaveNoViolations(results);
|
|
61
|
+
}
|
|
62
|
+
});
|
package/dist/web-types.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-ds/elements",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.6.0
|
|
4
|
+
"version": "2.6.0",
|
|
5
5
|
"packageManager": "pnpm@10.20.0",
|
|
6
6
|
"description": "Custom elements for Warp",
|
|
7
7
|
"exports": {
|
|
@@ -345,6 +345,7 @@
|
|
|
345
345
|
"@wc-toolkit/jsx-types": "^1.4.2",
|
|
346
346
|
"@wc-toolkit/storybook-helpers": "^9.0.1",
|
|
347
347
|
"@wc-toolkit/type-parser": "^1.2.0",
|
|
348
|
+
"axe-core": "^4.11.1",
|
|
348
349
|
"custom-element-jet-brains-integration": "^1.7.0",
|
|
349
350
|
"cz-conventional-changelog": "3.3.0",
|
|
350
351
|
"date-fns": "^4.1.0",
|