mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-17 21:48:07 +01:00
26 lines
815 B
TypeScript
26 lines
815 B
TypeScript
import { defineComponent } from 'vue'
|
|
import { describe, it, expect } from 'vitest'
|
|
import App from '../../src/runtime/components/App.vue'
|
|
import Toast, { type ToastProps } from '../../src/runtime/components/Toast.vue'
|
|
import ComponentRender from '../component-render'
|
|
|
|
const ToastWrapper = defineComponent({
|
|
components: {
|
|
UApp: App,
|
|
UToast: Toast
|
|
},
|
|
inheritAttrs: false,
|
|
template: '<UApp><UToast v-bind="$attrs" /></UApp>'
|
|
})
|
|
|
|
describe('Toast', () => {
|
|
it.each([
|
|
['basic case', {}],
|
|
['with class', { props: { class: '' } }],
|
|
['with ui', { props: { ui: {} } }]
|
|
])('renders %s correctly', async (nameOrHtml: string, options: { props?: ToastProps, slots?: any }) => {
|
|
const html = await ComponentRender(nameOrHtml, options, ToastWrapper)
|
|
expect(html).toMatchSnapshot()
|
|
})
|
|
})
|