mirror of
https://github.com/nuxt/ui.git
synced 2026-09-14 19:51:10 +08:00
5cb65cfbd0
Co-authored-by: Hugo Richard <hugo.richard@epitech.eu>
27 lines
1.4 KiB
TypeScript
27 lines
1.4 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import PageHeader from '../../src/runtime/components/PageHeader.vue'
|
|
import type { PageHeaderProps, PageHeaderSlots } from '../../src/runtime/components/PageHeader.vue'
|
|
import ComponentRender from '../component-render'
|
|
|
|
describe('PageHeader', () => {
|
|
it.each([
|
|
// Props
|
|
['with title', { props: { title: 'Title' } }],
|
|
['with description', { props: { description: 'Description' } }],
|
|
['with headline', { props: { headline: 'Headline' } }],
|
|
['with links', { props: { links: [{ label: 'GitHub', icon: 'i-simple-icons-github' }] } }],
|
|
['with as', { props: { as: 'section' } }],
|
|
['with class', { props: { class: 'py-12' } }],
|
|
['with ui', { props: { ui: { container: 'py-12' } } }],
|
|
// Slots
|
|
['with title slot', { slots: { title: () => 'Title slot' } }],
|
|
['with description slot', { slots: { description: () => 'Description slot' } }],
|
|
['with headline slot', { slots: { headline: () => 'Headline slot' } }],
|
|
['with links slot', { slots: { links: () => 'Links slot' } }],
|
|
['with default slot', { slots: { default: () => 'Default slot' } }]
|
|
])('renders %s correctly', async (nameOrHtml: string, options: { props?: PageHeaderProps, slots?: Partial<PageHeaderSlots> }) => {
|
|
const html = await ComponentRender(nameOrHtml, options, PageHeader)
|
|
expect(html).toMatchSnapshot()
|
|
})
|
|
})
|