| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b77de96 commit d4fbb5c
52 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -120,6 +120,9 @@ jobs: | |||
| 120 | 120 | - name: Test Examples | |
| 121 | 121 | run: pnpm run test:examples | |
| 122 | 122 | ||
| 123 | + - name: Unit Test UI | ||
| 124 | + run: pnpm -C packages/ui test:ui | ||
| 125 | + | ||
| 123 | 126 | - uses: actions/upload-artifact@v7 | |
| 124 | 127 | if: ${{ !cancelled() }} | |
| 125 | 128 | with: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -806,6 +806,11 @@ export default ({ mode }: { mode: string }) => { | |||
| 806 | 806 | link: '/guide/browser/trace-view', | |
| 807 | 807 | docFooterText: 'Trace View | Browser Mode', | |
| 808 | 808 | }, | |
| 809 | + { | ||
| 810 | + text: 'ARIA Snapshots', | ||
| 811 | + link: '/guide/browser/aria-snapshots', | ||
| 812 | + docFooterText: 'ARIA Snapshots | Browser Mode', | ||
| 813 | + }, | ||
| 809 | 814 | ], | |
| 810 | 815 | }, | |
| 811 | 816 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1010,6 +1010,43 @@ The same as [`toMatchSnapshot`](#tomatchsnapshot), but expects the same value as | |||
| 1010 | 1010 | ||
| 1011 | 1011 | The same as [`toMatchInlineSnapshot`](#tomatchinlinesnapshot), but expects the same value as [`toThrow`](#tothrow). | |
| 1012 | 1012 | ||
| 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 | + | ||
| 1013 | 1050 | ## toHaveBeenCalled | |
| 1014 | 1051 | ||
| 1015 | 1052 | - **Type:** `() => Awaitable<void>` | |
| Back | FazBrowse Home | New Git URL |
0 commit comments