feat(module)!: migrate to reka-ui (#2448)

This commit is contained in:
Benjamin Canac
2024-12-03 16:11:32 +01:00
committed by GitHub
parent c440c91a29
commit 81ac076219
229 changed files with 13487 additions and 13466 deletions

View File

@@ -11,19 +11,21 @@ describe('Checkbox', () => {
it.each([
// Props
['with modelValue', { props: { modelValue: true } }],
['with defaultValue', { props: { defaultValue: true } }],
['with id', { props: { id: 'id' } }],
['with name', { props: { name: 'name' } }],
['with value', { props: { value: 'value' } }],
['with disabled', { props: { disabled: true } }],
['with icon', { props: { icon: 'i-lucide-heart' } }],
['with indeterminate', { props: { indeterminate: true } }],
['with indeterminateIcon', { props: { indeterminate: true, icon: 'i-lucide-trash' } }],
['with indeterminate', { props: { defaultValue: 'indeterminate' } }],
['with indeterminateIcon', { props: { defaultValue: 'indeterminate', indeterminateIcon: 'i-lucide-trash' } }],
['with label', { props: { label: 'Label' } }],
['with required', { props: { label: 'Label', required: true } }],
['with description', { props: { label: 'Label', description: 'Description' } }],
...sizes.map((size: string) => [`with size ${size}`, { props: { size } }]),
['with color neutral', { props: { color: 'neutral', defaultValue: true } }],
['with as', { props: { as: 'section' } }],
['with class', { props: { class: 'inline-flex' } }],
['with ui', { props: { ui: { wrapper: 'ms-4' } } }],
// Slots
@@ -38,14 +40,14 @@ describe('Checkbox', () => {
test('update:modelValue event', async () => {
const wrapper = mount(Checkbox)
const input = wrapper.findComponent({ name: 'CheckboxRoot' })
await input.vm.$emit('update:checked', true)
await input.vm.$emit('update:modelValue', true)
expect(wrapper.emitted()).toMatchObject({ 'update:modelValue': [[true]] })
})
test('change event', async () => {
const wrapper = mount(Checkbox)
const input = wrapper.findComponent({ name: 'CheckboxRoot' })
await input.vm.$emit('update:checked', false)
await input.vm.$emit('update:modelValue', false)
expect(wrapper.emitted()).toMatchObject({ change: [[{ type: 'change' }]] })
})
})
@@ -77,24 +79,24 @@ describe('Checkbox', () => {
test('validate on change works', async () => {
const { input, wrapper } = await createForm(['change'])
await input.vm.$emit('update:checked', false)
await input.vm.$emit('update:modelValue', false)
await flushPromises()
expect(wrapper.text()).toContain('Error message')
await input.vm.$emit('update:checked', true)
await input.vm.$emit('update:modelValue', true)
await flushPromises()
expect(wrapper.text()).not.toContain('Error message')
})
test('validate on input works', async () => {
const { input, wrapper } = await createForm(['input'])
await input.vm.$emit('update:checked', false)
await input.vm.$emit('update:modelValue', false)
await flushPromises()
expect(wrapper.text()).toContain('Error message')
await input.vm.$emit('update:checked', true)
await input.vm.$emit('update:modelValue', true)
await flushPromises()
expect(wrapper.text()).not.toContain('Error message')
})