Files
ui/test/components/Link.spec.ts
Benjamin Canac d95556ebda test: update
2024-03-06 15:37:41 +01:00

17 lines
785 B
TypeScript

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()
})
})