From 7a51243dbe157c238b069c3a1f8d7359c4f144ad Mon Sep 17 00:00:00 2001 From: Arman Date: Mon, 6 Feb 2023 09:54:03 +0100 Subject: [PATCH] fix: wizard form submission --- tests/unit/layout/wizard.test.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/unit/layout/wizard.test.ts b/tests/unit/layout/wizard.test.ts index b985b96d1..10defbf74 100644 --- a/tests/unit/layout/wizard.test.ts +++ b/tests/unit/layout/wizard.test.ts @@ -59,7 +59,7 @@ test('shows next step with submit', async () => { expect(step1Required).toBeInTheDocument(); expect(step1Optional).toBeInTheDocument(); - form.submit(); + form.dispatchEvent(new Event('submit')); await tick(); expect(step1).not.toBeInTheDocument(); @@ -72,7 +72,7 @@ test('shows next step with submit', async () => { expect(step2First).toBeInTheDocument(); expect(step2Second).toBeInTheDocument(); - form.submit(); + form.dispatchEvent(new Event('submit')); await tick(); expect(form).not.toBeInTheDocument(); @@ -96,7 +96,8 @@ test('intercepts submit', async () => { expect(step1Optional).toBeInTheDocument(); await userEvent.type(step1Required, 'fail'); - form.submit(); + + form.dispatchEvent(new Event('submit')); await tick(); expect(step1).toBeInTheDocument(); @@ -104,7 +105,7 @@ test('intercepts submit', async () => { expect(step1Optional).toBeInTheDocument(); await userEvent.type(step1Required, 'works'); - form.submit(); + form.dispatchEvent(new Event('submit')); await tick(); expect(step1).not.toBeInTheDocument(); @@ -117,7 +118,7 @@ test('intercepts submit', async () => { expect(step2First).toBeInTheDocument(); expect(step2Second).toBeInTheDocument(); - form.submit(); + form.dispatchEvent(new Event('submit')); await tick(); expect(form).not.toBeInTheDocument();