Files
ui/test/components/Kbd.spec.ts
Benjamin Canac 959b1295f2 test: update
2024-03-13 12:27:10 +01:00

19 lines
872 B
TypeScript

import { describe, it, expect } from 'vitest'
import Kbd, { type KbdProps } from '../../src/runtime/components/Kbd.vue'
import ComponentRender from '../component-render'
describe('Kbd', () => {
it.each([
['with value', { props: { value: 'K' } }],
['with as', { props: { value: 'K', as: 'span' } }],
['with class', { props: { value: 'K', class: 'font-bold' } }],
['with size xs', { props: { value: 'K', size: 'xs' as const } }],
['with size sm', { props: { value: 'K', size: 'sm' as const } }],
['with size md', { props: { value: 'K', size: 'md' as const } }],
['with default slot', { slots: { default: () => 'Default slot' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: KbdProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, options, Kbd)
expect(html).toMatchSnapshot()
})
})