mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-27 02:10:40 +01:00
chore(RadioGroup): rename options prop to items (#98)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -7,27 +7,27 @@ describe('RadioGroup', () => {
|
||||
const sizes = Object.keys(theme.variants.size) as any
|
||||
const colors = Object.keys(theme.variants.color) as any
|
||||
|
||||
const options = [
|
||||
const items = [
|
||||
{ value: '1', label: 'Option 1' },
|
||||
{ value: '2', label: 'Option 2' },
|
||||
{ value: '3', label: 'Option 3' }
|
||||
]
|
||||
|
||||
it.each([
|
||||
['with options', { props: { options } }],
|
||||
['with defaultValue', { props: { options, defaultValue: '1' } }],
|
||||
['with disabled', { props: { options, disabled: true } }],
|
||||
['with description', { props: { options: options.map((opt, count) => ({ ...opt, description: `Description ${count}` })) } }],
|
||||
['with required', { props: { options, legend: 'Legend', required: true } }],
|
||||
...sizes.map((size: string) => [`with size ${size}`, { props: { options, size } }]),
|
||||
...colors.map((color: string) => [`with color ${color}`, { props: { options, color } }]),
|
||||
['with class', { props: { options, class: 'absolute' } }],
|
||||
['with ui', { props: { ui: { options, wrapper: 'ms-4' } } }],
|
||||
['with orientation', { props: { options, orientation: 'horizontal' } }],
|
||||
['with items', { props: { items } }],
|
||||
['with defaultValue', { props: { items, defaultValue: '1' } }],
|
||||
['with disabled', { props: { items, 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' } }],
|
||||
// Slots
|
||||
['with legend slot', { props: { options }, slots: { label: () => 'Legend slot' } }],
|
||||
['with label slot', { props: { options }, slots: { label: () => 'Label slot' } }],
|
||||
['with description slot', { slots: { label: () => 'Description slot' } }]
|
||||
['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' } }]
|
||||
])('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