mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
29 lines
1.5 KiB
TypeScript
29 lines
1.5 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import Separator, { type SeparatorProps, type SeparatorSlots } from '../../src/runtime/components/Separator.vue'
|
|
import ComponentRender from '../component-render'
|
|
import theme from '#build/ui/separator'
|
|
|
|
describe('Separator', () => {
|
|
const types = Object.keys(theme.variants.type) as any
|
|
const sizes = Object.keys(theme.variants.size) as any
|
|
const colors = Object.keys(theme.variants.color) as any
|
|
|
|
it.each([
|
|
// Props
|
|
['with as', { props: { as: 'span' } }],
|
|
['with label', { props: { label: '+1' } }],
|
|
['with icon', { props: { icon: 'i-heroicons-photo' } }],
|
|
['with avatar', { props: { avatar: { src: 'https://avatars.githubusercontent.com/u/739984?v=4' } } }],
|
|
['with orientation vertical', { props: { orientation: 'vertical' as const } }],
|
|
['with decorative', { props: { decorative: true } }],
|
|
...types.map((type: string) => [`with type ${type}`, { props: { type } }]),
|
|
...sizes.map((size: string) => [`with size ${size}`, { props: { size } }]),
|
|
...colors.map((color: string) => [`with color ${color}`, { props: { color } }]),
|
|
['with class', { props: { class: 'flex-row-reverse' } }],
|
|
['with ui', { props: { ui: { label: 'text-lg' } } }]
|
|
])('renders %s correctly', async (nameOrHtml: string, options: { props?: SeparatorProps, slots?: Partial<SeparatorSlots> }) => {
|
|
const html = await ComponentRender(nameOrHtml, options, Separator)
|
|
expect(html).toMatchSnapshot()
|
|
})
|
|
})
|