test: update

This commit is contained in:
Benjamin Canac
2024-03-11 15:14:40 +01:00
parent aaedabda3b
commit 82cb00ce52
6 changed files with 113 additions and 7 deletions

View File

@@ -0,0 +1,23 @@
import { describe, it, expect } from 'vitest'
import Avatar, { type AvatarProps } from '../../src/runtime/components/Avatar.vue'
import ComponentRender from '../component-render'
describe('Avatar', () => {
it.each([
['with src', { props: { src: 'https://avatars.githubusercontent.com/u/739984?v=4' } }],
['with alt', { props: { alt: 'Benjamin Canac' } }],
['with fallback', { props: { fallback: '+1' } }],
['with size 3xs', { props: { size: '3xs' as const } }],
['with size 2xs', { props: { size: '2xs' as const } }],
['with size xs', { props: { size: 'xs' as const } }],
['with size sm', { props: { size: 'sm' as const } }],
['with size md', { props: { size: 'md' as const } }],
['with size lg', { props: { size: 'lg' as const } }],
['with size xl', { props: { size: 'xl' as const } }],
['with size 2xl', { props: { size: '2xl' as const } }],
['with size 3xl', { props: { size: '3xl' as const } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: AvatarProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, options, Avatar)
expect(html).toMatchSnapshot()
})
})