mirror of
https://github.com/nuxt/ui.git
synced 2026-09-14 19:51:10 +08:00
f2d73e5bee
Co-authored-by: Jakub <jakub.michalek@freelo.io> Co-authored-by: Benjamin Canac <canacb1@gmail.com>
33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { axe } from 'vitest-axe'
|
|
import { mountSuspended } from '@nuxt/test-utils/runtime'
|
|
import DashboardSearchButton from '../../src/runtime/components/DashboardSearchButton.vue'
|
|
import type { DashboardSearchButtonProps } from '../../src/runtime/components/DashboardSearchButton.vue'
|
|
import ComponentRender from '../component-render'
|
|
|
|
describe('DashboardSearchButton', () => {
|
|
it.each([
|
|
// Props
|
|
['with label', { props: { label: 'Open' } }],
|
|
['with icon', { props: { icon: 'i-lucide-house' } }],
|
|
['with kbds', { props: { kbds: ['alt', 'o'] } }],
|
|
['with collapsed', { props: { collapsed: true } }],
|
|
['with class', { props: { class: 'w-full' } }]
|
|
])('renders %s correctly', async (nameOrHtml: string, options: { props?: DashboardSearchButtonProps }) => {
|
|
const html = await ComponentRender(nameOrHtml, options, DashboardSearchButton)
|
|
expect(html).toMatchSnapshot()
|
|
})
|
|
|
|
it('passes accessibility tests', async () => {
|
|
const wrapper = await mountSuspended(DashboardSearchButton, {
|
|
props: {
|
|
label: 'Open',
|
|
icon: 'i-lucide-house',
|
|
kbds: ['alt', 'o']
|
|
}
|
|
})
|
|
|
|
expect(await axe(wrapper.element)).toHaveNoViolations()
|
|
})
|
|
})
|