Files
nuxt__ui/test/components/DashboardGroup.spec.ts
Jakub Michálek f2d73e5bee test(components): add a11y tests (#5181)
Co-authored-by: Jakub <jakub.michalek@freelo.io>
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
2025-10-14 13:56:06 +02:00

26 lines
1.0 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import { axe } from 'vitest-axe'
import { mountSuspended } from '@nuxt/test-utils/runtime'
import DashboardGroup from '../../src/runtime/components/DashboardGroup.vue'
import type { DashboardGroupProps, DashboardGroupSlots } from '../../src/runtime/components/DashboardGroup.vue'
import ComponentRender from '../component-render'
describe('DashboardGroup', () => {
it.each([
// Props
['with as', { props: { as: 'section' } }],
['with class', { props: { class: 'inset-4' } }],
// Slots
['with default slot', { slots: { default: () => 'Default slot' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: DashboardGroupProps, slots?: Partial<DashboardGroupSlots> }) => {
const html = await ComponentRender(nameOrHtml, options, DashboardGroup)
expect(html).toMatchSnapshot()
})
it('passes accessibility tests', async () => {
const wrapper = await mountSuspended(DashboardGroup)
expect(await axe(wrapper.element)).toHaveNoViolations()
})
})