mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
chore(Form): catch-up with v2 changes (#2165)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -228,7 +228,7 @@ describe('Form', () => {
|
||||
expect(passwordField.text()).toBe('Required')
|
||||
})
|
||||
|
||||
test('valid submit works', async () => {
|
||||
test('validate on submit works', async () => {
|
||||
state.email = 'bob@dylan.com'
|
||||
state.password = 'strongpassword'
|
||||
|
||||
@@ -236,6 +236,7 @@ describe('Form', () => {
|
||||
|
||||
expect(wrapper.setupState.onSubmit).toHaveBeenCalledTimes(1)
|
||||
expect(wrapper.setupState.onSubmit).toHaveBeenCalledWith(expect.objectContaining({
|
||||
type: 'submit',
|
||||
data: {
|
||||
email: 'bob@dylan.com',
|
||||
password: 'strongpassword'
|
||||
|
||||
@@ -72,7 +72,7 @@ describe('RadioGroup', () => {
|
||||
items: ['Option 1', 'Option 2']
|
||||
},
|
||||
slotTemplate: `
|
||||
<UFormField name="value">
|
||||
<UFormField name="value" label="Radio group">
|
||||
<URadioGroup id="input" v-model="state.value" :items="items" />
|
||||
</UFormField>
|
||||
`
|
||||
@@ -107,5 +107,11 @@ describe('RadioGroup', () => {
|
||||
await flushPromises()
|
||||
expect(wrapper.text()).not.toContain('Error message')
|
||||
})
|
||||
|
||||
test('no label for=... on FormField', async () => {
|
||||
const { wrapper } = await createForm()
|
||||
const formFieldLabel = wrapper.findAll('label').map(label => label.attributes()).filter(label => !label.for?.includes('Option'))[0]
|
||||
expect(formFieldLabel.for).toBeUndefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user