feat(Skeleton): new component

This commit is contained in:
Benjamin Canac
2024-03-12 18:22:55 +01:00
parent 4b3a9855ac
commit e2fb25309f
7 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,13 @@
import { describe, it, expect } from 'vitest'
import Skeleton, { type SkeletonProps } from '../../src/runtime/components/Skeleton.vue'
import ComponentRender from '../component-render'
describe('Skeleton', () => {
it.each([
['basic case', {}],
['with class', { props: { class: 'rounded-full size-12' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: SkeletonProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, options, Skeleton)
expect(html).toMatchSnapshot()
})
})

View File

@@ -0,0 +1,5 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`Skeleton > renders basic case correctly 1`] = `"<div class="animate-pulse rounded-md bg-gray-50 dark:bg-gray-800"></div>"`;
exports[`Skeleton > renders with class correctly 1`] = `"<div class="animate-pulse bg-gray-50 dark:bg-gray-800 rounded-full size-12"></div>"`;