import { describe, it, expect } from 'vitest' import RadioGroup, { type RadioGroupProps, type RadioGroupSlots } from '../../src/runtime/components/RadioGroup.vue' import ComponentRender from '../component-render' import theme from '#build/ui/radio-group' describe('RadioGroup', () => { const sizes = Object.keys(theme.variants.size) as any const colors = Object.keys(theme.variants.color) as any const items = [ { value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }, { value: '3', label: 'Option 3' } ] const props = { items } it.each([ ['with items', { props }], ['with defaultValue', { props: { ...props, defaultValue: '1' } }], ['with disabled', { props: { ...props, disabled: true } }], ['with description', { props: { items: items.map((opt, count) => ({ ...opt, description: `Description ${count}` })) } }], ['with required', { props: { ...props, legend: 'Legend', required: true } }], ...sizes.map((size: string) => [`with size ${size}`, { props: { ...props, size } }]), ...colors.map((color: string) => [`with color ${color}`, { props: { ...props, color } }]), ['with class', { props: { ...props, class: 'absolute' } }], ['with ui', { props: { ...props, ui: { wrapper: 'ms-4' } } }], ['with orientation', { props: { ...props, orientation: 'horizontal' } }], // Slots ['with legend slot', { props, slots: { label: () => 'Legend slot' } }], ['with label slot', { props, slots: { label: () => 'Label slot' } }], ['with description slot', { props, slots: { label: () => 'Description slot' } }] ])('renders %s correctly', async (nameOrHtml: string, options: { props?: RadioGroupProps, slots?: Partial> }) => { const html = await ComponentRender(nameOrHtml, options, RadioGroup) expect(html).toMatchSnapshot() }) })