Files
nuxt__ui/test/components/PageHeader.spec.ts
Benjamin Canac 5cb65cfbd0 feat: import @nuxt/ui-pro components (#4675)
Co-authored-by: Hugo Richard <hugo.richard@epitech.eu>
2025-09-01 14:30:39 +02:00

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()
})
})