test: add initial component tests (#923)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Juho Rutila
2023-11-17 11:49:43 +02:00
committed by GitHub
parent b666c4a1a8
commit bcc46b87f5
11 changed files with 603 additions and 62 deletions

View File

@@ -0,0 +1,14 @@
import { describe, it, expect } from 'vitest'
import Skeleton from '../../../src/runtime/components/layout/Skeleton.vue'
import type { TypeOf } from 'zod'
import ComponentRender from '../component-render'
describe('Skeleton', () => {
it.each([
[ 'basic case', { } ],
[ '<USkeleton class="h-12 w-12" :ui="{ rounded: \'rounded-full\' }" />' ]
])('renders %s correctly', async (nameOrHtml: string, options: TypeOf<typeof Skeleton.props>) => {
const html = await ComponentRender(nameOrHtml, options, Skeleton)
expect(html).toMatchSnapshot()
})
})