feat: uniformize components sizes (#68)

This commit is contained in:
Benjamin Canac
2024-04-16 12:26:29 +02:00
committed by GitHub
parent 78e45600de
commit f302a15972
96 changed files with 1854 additions and 1720 deletions

View File

@@ -1,27 +1,26 @@
import { describe, it, expect } from 'vitest'
import Slider, { type SliderProps } from '../../src/runtime/components/Slider.vue'
import ComponentRender from '../component-render'
import theme from '#build/ui/slider'
describe('Slider', () => {
const sizes = Object.keys(theme.variants.size) as any
const colors = Object.keys(theme.variants.color) as any
it.each([
['basic case', {}],
['with class', { props: { class: 'w-48' } }],
['with ui', { props: { ui: { track: 'bg-gray-100 dark:bg-gray-800' } } }],
// Props
['with defaultValue', { props: { defaultValue: 10 } }],
['with multiple thumbs', { props: { defaultValue: [0, 10] } }],
['with name', { props: { name: 'custom-name' } }],
['with disabled', { props: { disabled: true } }],
['with inverted', { props: { inverted: true } }],
['with orientation', { props: { orientation: 'vertical' as const } }],
['with orientation vertical', { props: { orientation: 'vertical' as const } }],
['with min max step', { props: { min: 4, max: 12, step: 2 } }],
['with min steps between thumbs', { props: { defaultValue: [0, 30], minStepsBetweenThumbs: 30 } }],
['with color', { props: { color: 'red' 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 } }]
...sizes.map((size: string) => [`with size ${size}`, { props: { size } }]),
...colors.map((color: string) => [`with color ${color}`, { props: { color } }]),
['with class', { props: { class: 'w-48' } }],
['with ui', { props: { ui: { track: 'bg-gray-100 dark:bg-gray-800' } } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: SliderProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, options, Slider)
expect(html).toMatchSnapshot()