Skip to content

Commit ed98046

Browse files
committed
test: add a11y test for alert component
1 parent 1a12238 commit ed98046

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/nuxt/a11y.spec.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ vi.mock('vue-data-ui/vue-ui-xy', () => {
116116
// Import components from #components where possible
117117
// For server/client variants, we need to import directly to test the specific variant
118118
import {
119+
Alert,
119120
AppFooter,
120121
AppHeader,
121122
AppLogo,
@@ -3510,6 +3511,35 @@ describe('component accessibility audits', () => {
35103511
expect(results.violations).toEqual([])
35113512
})
35123513
})
3514+
3515+
describe('Alert', () => {
3516+
it('should have no accessibility violations for warning variant', async () => {
3517+
const component = await mountSuspended(Alert, {
3518+
props: { variant: 'warning', title: 'Warning title' },
3519+
slots: { default: 'This is a warning message.' },
3520+
})
3521+
const results = await runAxe(component)
3522+
expect(results.violations).toEqual([])
3523+
})
3524+
3525+
it('should have no accessibility violations for error variant', async () => {
3526+
const component = await mountSuspended(Alert, {
3527+
props: { variant: 'error', title: 'Error title' },
3528+
slots: { default: 'This is an error message.' },
3529+
})
3530+
const results = await runAxe(component)
3531+
expect(results.violations).toEqual([])
3532+
})
3533+
3534+
it('should have no accessibility violations without title', async () => {
3535+
const component = await mountSuspended(Alert, {
3536+
props: { variant: 'warning' },
3537+
slots: { default: 'This is a warning message.' },
3538+
})
3539+
const results = await runAxe(component)
3540+
expect(results.violations).toEqual([])
3541+
})
3542+
})
35133543
})
35143544

35153545
function applyTheme(colorMode: string, bgTheme: string | null) {

0 commit comments

Comments
 (0)