chore(Checkbox/Switch): change model binding (#58)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Romain Hamel
2024-04-15 13:37:18 +02:00
committed by GitHub
parent 2fe91f3847
commit 84847965af
15 changed files with 903 additions and 565 deletions

View File

@@ -6,23 +6,28 @@ import ComponentRender from '../component-render'
describe('Checkbox', () => {
it.each([
['basic case', {}],
['with label', { props: { label: 'Label' } }],
['with slot', { slots: { default: () => 'Label slot' } }],
['with slot label', { slots: { label: () => 'Label slot' } }],
['with custom id', { props: { id: 'custom-id' } }],
['with custom value', { props: { value: 'custom-value' } }],
['with custom name', { props: { name: 'custom-name' } }],
['with class', { props: { class: 'inline-flex' } }],
['with ui', { props: { ui: { wrapper: 'ms-4' } } }],
['with defaultValue', { props: { defaultValue: true } }],
['with id', { props: { id: 'custom-id' } }],
['with name', { props: { name: 'custom-name' } }],
['with value', { props: { value: 'custom-value' } }],
['with disabled', { props: { disabled: true } }],
['with icon', { props: { icon: 'i-heroicons-heart' } }],
['with indeterminate', { props: { indeterminate: true } }],
['with help', { props: { label: 'Label', help: 'Help' } }],
['with indeterminateIcon', { props: { indeterminate: true, icon: 'i-heroicons-trash' } }],
['with label', { props: { label: 'Label' } }],
['with required', { props: { label: 'Label', required: true } }],
['with custom color', { props: { label: 'Label', color: 'red' as const } }],
['with description', { props: { label: 'Label', description: 'Description' } }],
['with color', { props: { label: 'Label', 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 } }]
['with size xl', { props: { size: 'xl' as const } }],
['with label slot', { slots: { label: () => 'Label slot' } }],
['with description slot', { slots: { label: () => 'Description slot' } }]
])('renders %s correctly', async (nameOrHtml: string, options: { props?: CheckboxProps, slots?: any }) => {
const html = await ComponentRender(nameOrHtml, defu(options, { props: { id: 42 } }), Checkbox)
expect(html).toMatchSnapshot()