mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
feat: uniformize components sizes (#68)
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
import { describe, it, expect } from 'vitest'
|
||||
import Badge, { type BadgeProps } from '../../src/runtime/components/Badge.vue'
|
||||
import ComponentRender from '../component-render'
|
||||
import theme from '#build/ui/badge'
|
||||
|
||||
describe('Badge', () => {
|
||||
const sizes = Object.keys(theme.variants.size) as any
|
||||
const colors = Object.keys(theme.variants.color) as any
|
||||
const variants = Object.keys(theme.variants.variant) as any
|
||||
|
||||
it.each([
|
||||
// Props
|
||||
['with label', { props: { label: 'Badge' } }],
|
||||
['with as', { props: { label: 'Badge', as: 'div' } }],
|
||||
['with class', { props: { label: 'Badge', class: 'rounded-full font-bold' } }],
|
||||
['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 } }],
|
||||
['with color black', { props: { label: 'Badge', color: 'black' as const } }],
|
||||
['with variant outline', { props: { label: 'Badge', variant: 'outline' as const } }],
|
||||
['with variant soft', { props: { label: 'Badge', variant: 'soft' as const } }],
|
||||
['with variant link', { props: { label: 'Badge', variant: 'subtle' as const } }],
|
||||
...sizes.map((size: string) => [`with size ${size}`, { props: { label: 'Badge', size } }]),
|
||||
...colors.map((color: string) => [`with color ${color}`, { props: { label: 'Badge', color } }]),
|
||||
...variants.map((variant: string) => [`with variant ${variant}`, { props: { label: 'Badge', variant } }]),
|
||||
// Slots
|
||||
['with default slot', { slots: { default: () => 'Default slot' } }]
|
||||
])('renders %s correctly', async (nameOrHtml: string, options: { props?: BadgeProps, slots?: any }) => {
|
||||
const html = await ComponentRender(nameOrHtml, options, Badge)
|
||||
|
||||
Reference in New Issue
Block a user