test: update

This commit is contained in:
Benjamin Canac
2024-03-06 15:37:41 +01:00
parent d69817a128
commit d95556ebda
5 changed files with 54 additions and 24 deletions

View File

@@ -0,0 +1,17 @@
import { describe, it, expect } from 'vitest'
import Link, { type LinkProps } from '../../src/runtime/components/Link.vue'
import ComponentRender from '../component-render'
describe('Link', () => {
it.each([
['with as', { props: { as: 'div' } }],
['with to', { props: { to: '/' } }],
['with type', { props: { type: 'submit' } }],
['with disabled', { props: { disabled: true } }],
['with activeClass', { props: { active: true, to: '/', activeClass: 'text-sm' } }],
['with inactiveClass', { props: { active: false, to: '/', inactiveClass: 'text-gray-300' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props: LinkProps }) => {
const html = await ComponentRender(nameOrHtml, options, Link)
expect(html).toMatchSnapshot()
})
})