diff --git a/test/components/Avatar.spec.ts b/test/components/Avatar.spec.ts new file mode 100644 index 00000000..666d68ad --- /dev/null +++ b/test/components/Avatar.spec.ts @@ -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() + }) +}) diff --git a/test/components/Badge.spec.ts b/test/components/Badge.spec.ts index 5de537ca..c23f53f7 100644 --- a/test/components/Badge.spec.ts +++ b/test/components/Badge.spec.ts @@ -6,7 +6,10 @@ describe('Badge', () => { it.each([ ['with label', { props: { label: 'Badge' } }], ['with class', { props: { class: 'rounded-full font-bold' } }], - ['with size', { props: { label: 'Badge', size: 'lg' as const } }], + ['with size xs', { props: { label: 'Badge', size: 'xs' as const } }], + ['with size sm', { props: { label: 'Badge', size: 'sm' as const } }], + ['with size md', { props: { label: 'Badge', size: 'md' as const } }], + ['with size lg', { props: { label: 'Badge', size: 'lg' as const } }], ['with color green', { props: { label: 'Badge', color: 'green' as const } }], ['with color white', { props: { label: 'Badge', color: 'white' as const } }], ['with color gray', { props: { label: 'Badge', color: 'gray' as const } }], diff --git a/test/components/Button.spec.ts b/test/components/Button.spec.ts index 30413086..a0d27033 100644 --- a/test/components/Button.spec.ts +++ b/test/components/Button.spec.ts @@ -6,7 +6,12 @@ describe('Button', () => { it.each([ ['with label', { props: { label: 'Button' } }], ['with class', { props: { class: 'rounded-full font-bold' } }], - ['with size', { props: { label: 'Button', size: 'lg' as const } }], + ['with size 2xs', { props: { label: 'Button', size: '2xs' as const } }], + ['with size xs', { props: { label: 'Button', size: 'xs' as const } }], + ['with size sm', { props: { label: 'Button', size: 'sm' as const } }], + ['with size md', { props: { label: 'Button', size: 'md' as const } }], + ['with size lg', { props: { label: 'Button', size: 'lg' as const } }], + ['with size xl', { props: { label: 'Button', size: 'xl' as const } }], ['with color', { props: { label: 'Button', color: 'red' as const } }], ['with variant outline', { props: { label: 'Button', variant: 'outline' as const } }], ['with variant soft', { props: { label: 'Button', variant: 'soft' as const } }], diff --git a/test/components/__snapshots__/Avatar.spec.ts.snap b/test/components/__snapshots__/Avatar.spec.ts.snap new file mode 100644 index 00000000..758fc2cf --- /dev/null +++ b/test/components/__snapshots__/Avatar.spec.ts.snap @@ -0,0 +1,25 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`Avatar > renders with alt correctly 1`] = `"BC"`; + +exports[`Avatar > renders with fallback correctly 1`] = `"+1"`; + +exports[`Avatar > renders with size 2xl correctly 1`] = `""`; + +exports[`Avatar > renders with size 2xs correctly 1`] = `""`; + +exports[`Avatar > renders with size 3xl correctly 1`] = `""`; + +exports[`Avatar > renders with size 3xs correctly 1`] = `""`; + +exports[`Avatar > renders with size lg correctly 1`] = `""`; + +exports[`Avatar > renders with size md correctly 1`] = `""`; + +exports[`Avatar > renders with size sm correctly 1`] = `""`; + +exports[`Avatar > renders with size xl correctly 1`] = `""`; + +exports[`Avatar > renders with size xs correctly 1`] = `""`; + +exports[`Avatar > renders with src correctly 1`] = `""`; diff --git a/test/components/__snapshots__/Badge.spec.ts.snap b/test/components/__snapshots__/Badge.spec.ts.snap index 34265e2d..9f70e6ff 100644 --- a/test/components/__snapshots__/Badge.spec.ts.snap +++ b/test/components/__snapshots__/Badge.spec.ts.snap @@ -16,6 +16,14 @@ exports[`Badge > renders with label correctly 1`] = `"Badge"`; +exports[`Badge > renders with size lg correctly 1`] = `"Badge"`; + +exports[`Badge > renders with size md correctly 1`] = `"Badge"`; + +exports[`Badge > renders with size sm correctly 1`] = `"Badge"`; + +exports[`Badge > renders with size xs correctly 1`] = `"Badge"`; + exports[`Badge > renders with variant link correctly 1`] = `"Badge"`; exports[`Badge > renders with variant outline correctly 1`] = `"Badge"`; diff --git a/test/components/__snapshots__/Button.spec.ts.snap b/test/components/__snapshots__/Button.spec.ts.snap index d5bac1f4..5aca108c 100644 --- a/test/components/__snapshots__/Button.spec.ts.snap +++ b/test/components/__snapshots__/Button.spec.ts.snap @@ -31,7 +31,7 @@ exports[`Button > renders with disabled correctly 1`] = ` `; exports[`Button > renders with icon correctly 1`] = ` -"" +`; + exports[`Button > renders with size correctly 1`] = ` "" `; +exports[`Button > renders with size lg correctly 1`] = ` +"" +`; + +exports[`Button > renders with size md correctly 1`] = ` +"" +`; + +exports[`Button > renders with size sm correctly 1`] = ` +"" +`; + +exports[`Button > renders with size xl correctly 1`] = ` +"" +`; + +exports[`Button > renders with size xs correctly 1`] = ` +"" +`; + exports[`Button > renders with square correctly 1`] = ` ""