Wiki source code of Accessibility test API
Last modified by Manuel Leduc on 2026/03/25 15:23
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | == Variables == |
| 2 | |||
| 3 | == test == | ||
| 4 | |||
| 5 | An [[extended>>https://vitest.dev/api/test.html#test-extend]] version of [[test>>https://vitest.dev/api/test.html]] from [[Vitest>>https://vitest.dev/]] that runs an axe-core validation on the tested Vue container after the end of the test. | ||
| 6 | |||
| 7 | === it === | ||
| 8 | |||
| 9 | Alias of [[test>>||anchor="Htest"]]. | ||
| 10 | |||
| 11 | == Functions == | ||
| 12 | |||
| 13 | === assertAxe === | ||
| 14 | |||
| 15 | Run an axe core check on the provided vue component wrapper and check for the absence of issues. | ||
| 16 | |||
| 17 | {{code language='typescript'}} | ||
| 18 | assertAxe(wrapper: VueWrapper): Promise<void> | ||
| 19 | {{/code}} | ||
| 20 | |||
| 21 | === mountHelper === | ||
| 22 | |||
| 23 | Helper to initialize a Vue Wrapper with the right configuration. In particular making sure that the component is mounted with and attached to an HTML document body. Returns a method that expect additional mount option to be merged with the default. | ||
| 24 | |||
| 25 | {{code language='typescript'}} | ||
| 26 | mountHelper( | ||
| 27 | component: Component, | ||
| 28 | baseConfig?: Record<string, unknown>, | ||
| 29 | ): (config?: Record<string, unknown>) => VueWrapper | ||
| 30 | {{/code}} | ||
| 31 | |||
| 32 | === runTest === | ||
| 33 | |||
| 34 | Execute a test and checks for the accessibility of the tested component with axe core at the end. | ||
| 35 | |||
| 36 | {{code language='typescript'}} | ||
| 37 | runTest( | ||
| 38 | name: string, | ||
| 39 | wrapper: VueWrapper, | ||
| 40 | assertions: (wrapper: VueWrapper) => void | Promise<void>, | ||
| 41 | ): void | ||
| 42 | {{/code}} | ||
| 43 | |||
| 44 | === shallowMountHelper === | ||
| 45 | |||
| 46 | Helper to initialize a Vue Wrapper with the right configuration. In particular making sure that the component is shallow mounted with and attached to an HTML document body. Returns a method that expect additional shallow mount option to be merged with the default | ||
| 47 | |||
| 48 | {{code language='typescript'}} | ||
| 49 | shallowMountHelper( | ||
| 50 | component: Component, | ||
| 51 | baseConfig?: Record<string, unknown>, | ||
| 52 | ): (config?: Record<string, unknown>) => VueWrapper | ||
| 53 | {{/code}} |