Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d4fbb5c

Browse filesBrowse files
hi-ogawaclaudeAriPerkkiocodexsheremet-va
authored
feat(experimental): support aria snapshot (#9668)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Ari Perkkiö <ari.perkkio@gmail.com> Co-authored-by: Codex <noreply@openai.com> Co-authored-by: Vladimir <sleuths.slews0s@icloud.com>
1 parent b77de96 commit d4fbb5c
Copy full SHA for d4fbb5c

52 files changed

+4,067-170Lines changed: 4067 additions & 170 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/ci.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/ci.yml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ jobs:
120120
- name: Test Examples
121121
run: pnpm run test:examples
122122

123+
- name: Unit Test UI
124+
run: pnpm -C packages/ui test:ui
125+
123126
- uses: actions/upload-artifact@v7
124127
if: ${{ !cancelled() }}
125128
with:
Collapse file

‎docs/.vitepress/config.ts‎

Copy file name to clipboardExpand all lines: docs/.vitepress/config.ts
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,11 @@ export default ({ mode }: { mode: string }) => {
806806
link: '/guide/browser/trace-view',
807807
docFooterText: 'Trace View | Browser Mode',
808808
},
809+
{
810+
text: 'ARIA Snapshots',
811+
link: '/guide/browser/aria-snapshots',
812+
docFooterText: 'ARIA Snapshots | Browser Mode',
813+
},
809814
],
810815
},
811816
{
Collapse file

‎docs/api/expect.md‎

Copy file name to clipboardExpand all lines: docs/api/expect.md
+37Lines changed: 37 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,43 @@ The same as [`toMatchSnapshot`](#tomatchsnapshot), but expects the same value as
10101010

10111011
The same as [`toMatchInlineSnapshot`](#tomatchinlinesnapshot), but expects the same value as [`toThrow`](#tothrow).
10121012

1013+
## toMatchAriaSnapshot <Version type="experimental">4.1.4</Version> <Experimental /> {#tomatcharisnapshot}
1014+
1015+
- **Type:** `() => void`
1016+
1017+
Captures the accessibility tree of a DOM element and generate a snapshot file or compares it against a stored snapshot. See the [ARIA Snapshots guide](/guide/browser/aria-snapshots) for more details.
1018+
1019+
```ts
1020+
import { expect, test } from 'vitest'
1021+
1022+
test('navigation accessibility', () => {
1023+
document.body.innerHTML = `
1024+
<nav aria-label="Actions">
1025+
<button>Save</button>
1026+
<button>Cancel</button>
1027+
</nav>
1028+
`
1029+
expect(document.querySelector('nav')).toMatchAriaSnapshot()
1030+
})
1031+
```
1032+
1033+
## toMatchAriaInlineSnapshot <Version type="experimental">4.1.4</Version> <Experimental /> {#tomatchariainlinesnapshot}
1034+
1035+
- **Type:** `(snapshot?: string) => void`
1036+
1037+
Same as [`toMatchAriaSnapshot`](#tomatcharisnapshot), but stores the snapshot inline in the test file. See the [ARIA Snapshots guide](/guide/browser/aria-snapshots) for more details.
1038+
1039+
```ts
1040+
import { expect, test } from 'vitest'
1041+
1042+
test('user profile', () => {
1043+
expect(document.body).toMatchAriaInlineSnapshot(`
1044+
- heading "Dashboard" [level=1]
1045+
- button /User \\d+/: Profile
1046+
`)
1047+
})
1048+
```
1049+
10131050
## toHaveBeenCalled
10141051

10151052
- **Type:** `() => Awaitable<void>`

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.