mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-19 14:31:47 +01:00
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import Breadcrumb, { type BreadcrumbProps } from '../../src/runtime/components/Breadcrumb.vue'
|
|
import ComponentRender from '../component-render'
|
|
|
|
describe('Breadcrumb', () => {
|
|
const links = [{
|
|
label: 'Home',
|
|
avatar: {
|
|
src: 'https://avatars.githubusercontent.com/u/739984?v=4'
|
|
},
|
|
to: '/'
|
|
}, {
|
|
label: 'Navigation',
|
|
icon: 'i-heroicons-square-3-stack-3d',
|
|
disabled: true
|
|
}, {
|
|
label: 'Breadcrumb',
|
|
icon: 'i-heroicons-link'
|
|
}]
|
|
|
|
it.each([
|
|
// Props
|
|
['with links', { props: { links } }],
|
|
['with separatorIcon', { props: { links, separatorIcon: 'i-heroicons-minus' } }],
|
|
['with class', { props: { class: 'w-48' } }],
|
|
['with ui', { props: { ui: { link: 'font-bold' } } }],
|
|
// Slots
|
|
['with default slot', { slots: { default: () => 'Default slot' } }],
|
|
['with leading slot', { slots: { leading: () => 'Leading slot' } }],
|
|
['with trailing slot', { slots: { trailing: () => 'Trailing slot' } }],
|
|
['with separator slot', { slots: { separator: () => '/' } }]
|
|
])('renders %s correctly', async (nameOrHtml: string, options: { props?: BreadcrumbProps<typeof links[number]>, slots?: any }) => {
|
|
const html = await ComponentRender(nameOrHtml, options, Breadcrumb)
|
|
expect(html).toMatchSnapshot()
|
|
})
|
|
})
|