mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benjamin Canac <canacb1@gmail.com>
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import Popover from '../../src/runtime/components/Popover.vue'
|
|
import type { PopoverProps, PopoverSlots } from '../../src/runtime/components/Popover.vue'
|
|
import ComponentRender from '../component-render'
|
|
|
|
describe('Popover', () => {
|
|
const props = { open: true, portal: false }
|
|
|
|
it.each([
|
|
// Props
|
|
['with open', { props }],
|
|
['with arrow', { props: { ...props, arrow: true } }],
|
|
['with class', { props: { ...props, class: 'shadow-xl' } }],
|
|
['with ui', { props: { ...props, ui: { content: 'shadow-xl' } } }],
|
|
// Slots
|
|
['with default slot', { props, slots: { default: () => 'Default slot' } }],
|
|
['with content slot', { props, slots: { content: () => 'Content slot' } }],
|
|
['with anchor slot', { props, slots: { anchor: () => 'Anchor slot' } }]
|
|
])('renders %s correctly', async (nameOrHtml: string, options: { props?: PopoverProps, slots?: Partial<PopoverSlots> }) => {
|
|
const html = await ComponentRender(nameOrHtml, options, Popover)
|
|
expect(html).toMatchSnapshot()
|
|
})
|
|
})
|