refactor(Form): input events (#99)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
Romain Hamel
2024-07-01 20:37:57 +02:00
committed by GitHub
parent ca029a4b6c
commit bad2e49de9
22 changed files with 947 additions and 388 deletions

53
test/utils/form.ts Normal file
View File

@@ -0,0 +1,53 @@
import { reactive } from 'vue'
import { mountSuspended } from '@nuxt/test-utils/runtime'
import type { FormProps } from '../../src/runtime/components/Form.vue'
import {
UForm,
UInput,
UFormField,
URadioGroup,
UTextarea,
UCheckbox,
USelect,
USelectMenu,
UInputMenu,
USwitch,
USlider
} from '#components'
export async function renderForm(options: {
props: Partial<FormProps<any>>
slotVars?: object
slotTemplate: string
}) {
const state = reactive({})
return await mountSuspended(UForm, {
props: {
id: 42,
state,
...options.props
},
slots: {
default: {
setup() {
return { state, ...options.slotVars }
},
components: {
UFormField,
UForm,
UInput,
URadioGroup,
UTextarea,
UCheckbox,
USelect,
USelectMenu,
UInputMenu,
USwitch,
USlider
},
template: options.slotTemplate
}
}
})
}