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>
26 lines
1.2 KiB
TypeScript
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()
|
|
})
|
|
})
|