fix(Form)!: include nested state in submit data (#3028)

This commit is contained in:
Romain Hamel
2025-01-14 10:49:39 +01:00
committed by GitHub
parent 865a47f125
commit de9ecb1d76
4 changed files with 21 additions and 9 deletions

View File

@@ -347,6 +347,15 @@ describe('Form', () => {
expect(nestedField.text()).toBe('Required')
})
test('submit event contains nested attributes', async () => {
state.email = 'bob@dylan.com'
state.password = 'strongpassword'
state.nested.field = 'nested'
await form.value.submit()
expect(wrapper.setupState.onSubmit).toHaveBeenCalledWith(expect.objectContaining({ data: { email: 'bob@dylan.com', password: 'strongpassword', nested: { field: 'nested' } } }))
})
test('submit works when child is disabled', async () => {
await form.value.submit()
expect(wrapper.setupState.onError).toHaveBeenCalledTimes(1)