Files
nuxt__ui/test/components/ChatPrompt.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

26 lines
1.2 KiB
TypeScript

import { describe, it, expect } from 'vitest'
import ChatPrompt from '../../src/runtime/components/ChatPrompt.vue'
import type { ChatPromptProps, ChatPromptSlots } from '../../src/runtime/components/ChatPrompt.vue'
import ComponentRender from '../component-render'
import theme from '#build/ui/chat-prompt'
describe('ChatPrompt', () => {
const variants = Object.keys(theme.variants.variant) as any
it.each([
// Props
['with placeholder', { props: { placeholder: 'Placeholder' } }],
['with error', { props: { error: new Error('Error') } }],
...variants.map((variant: string) => [`with variant ${variant}`, { props: { variant } }]),
['with as', { props: { as: 'section' } }],
['with class', { props: { class: 'p-5' } }],
['with ui', { props: { ui: { footer: 'justify-end' } } }],
// Slots
['with header slot', { slots: { header: () => 'Header slot' } }],
['with footer slot', { slots: { footer: () => 'Footer slot' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: ChatPromptProps, slots?: Partial<ChatPromptSlots> }) => {
const html = await ComponentRender(nameOrHtml, options, ChatPrompt)
expect(html).toMatchSnapshot()
})
})