Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions playwright/e2e/submit-form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,27 @@ test('Enter with the IME key code 229 keeps the focus in the answer', async ({
submitView.getQuestion('Country').getByRole('textbox'),
).toBeFocused()
})

test('A corrected answer submits right away', async ({ page, submitView }) => {
const form = await api(page.request, 'POST', '/forms')
const question = await api(page.request, 'POST', `/forms/${form.id}/questions`, {
type: 'short',
text: 'Email',
})
await api(page.request, 'PATCH', `/forms/${form.id}/questions/${question.id}`, {
keyValuePairs: { extraSettings: { validationType: 'email' } },
})
await page.goto(`apps/forms/${form.hash}/submit`)

await submitView.fillText('Email', 'not an email')
await submitView.submitButton.click()
await expect(
submitView
.getQuestion('Email')
.getByText('The input is not a valid email address'),
).toBeVisible()

await submitView.fillText('Email', 'jane@example.com')
await submitView.submit()
await expect(submitView.successMessage).toBeVisible()
})
1 change: 1 addition & 0 deletions src/components/Questions/QuestionShort.vue
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ export default defineComponent({
if (!field) {
return
}
field.setCustomValidity('')
emit('update:values', [field.value])
void debounceValidate()
}
Expand Down
Loading