mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-28 10:50:40 +01:00
test(RadioGroup): improve
This commit is contained in:
@@ -13,21 +13,23 @@ describe('RadioGroup', () => {
|
||||
{ value: '3', label: 'Option 3' }
|
||||
]
|
||||
|
||||
const props = { items }
|
||||
|
||||
it.each([
|
||||
['with items', { props: { items } }],
|
||||
['with defaultValue', { props: { items, defaultValue: '1' } }],
|
||||
['with disabled', { props: { items, disabled: true } }],
|
||||
['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: { items, legend: 'Legend', required: true } }],
|
||||
...sizes.map((size: string) => [`with size ${size}`, { props: { items, size } }]),
|
||||
...colors.map((color: string) => [`with color ${color}`, { props: { items, color } }]),
|
||||
['with class', { props: { items, class: 'absolute' } }],
|
||||
['with ui', { props: { ui: { items, wrapper: 'ms-4' } } }],
|
||||
['with orientation', { props: { items, orientation: 'horizontal' } }],
|
||||
['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: { items }, slots: { label: () => 'Legend slot' } }],
|
||||
['with label slot', { props: { items }, slots: { label: () => 'Label slot' } }],
|
||||
['with description slot', { props: { items }, slots: { label: () => 'Description slot' } }]
|
||||
['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<any>, slots?: Partial<RadioGroupSlots<any>> }) => {
|
||||
const html = await ComponentRender(nameOrHtml, options, RadioGroup)
|
||||
expect(html).toMatchSnapshot()
|
||||
|
||||
Reference in New Issue
Block a user