-
Notifications
You must be signed in to change notification settings - Fork 706
/
Copy pathLink.spec.ts
23 lines (22 loc) · 1.06 KB
/
Link.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { describe, it, expect } from 'vitest'
import { ULink as Link } from '#components'
import type { LinkProps, LinkSlots } from '../../src/runtime/components/Link.vue'
import ComponentRender from '../component-render'
describe('Link', () => {
it.each([
// Props
['with as', { props: { as: 'div' } }],
['with to', { props: { to: '/' } }],
['with type', { props: { type: 'submit' as const } }],
['with disabled', { props: { disabled: true } }],
['with raw', { props: { raw: true } }],
['with class', { props: { class: 'font-medium' } }],
['with activeClass', { props: { active: true, activeClass: 'text-(--ui-text-highlighted)' } }],
['with inactiveClass', { props: { active: false, inactiveClass: 'hover:text-(--ui-primary)' } }],
// Slots
['with default slot', { slots: { default: () => 'Default slot' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: LinkProps, slots?: Partial<LinkSlots> }) => {
const html = await ComponentRender(nameOrHtml, options, Link)
expect(html).toMatchSnapshot()
})
})