mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
feat(Toast): new component (#50)
This commit is contained in:
25
test/components/Toast.spec.ts
Normal file
25
test/components/Toast.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
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()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user