From b8e308f511f48882ebad301924ad54d48af70744 Mon Sep 17 00:00:00 2001 From: Shu Ding Date: Thu, 8 Jun 2023 19:25:56 +0200 Subject: [PATCH] Add test for hidden form fields at the beginning of a Server Action form (#50978) Fixes #50087. The root cause was fixed in upstream React and here's a test to ensure it works end to end. fix NEXT-1228 --- test/e2e/app-dir/actions/app-action.test.ts | 2 +- test/e2e/app-dir/actions/app/server/form.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test/e2e/app-dir/actions/app-action.test.ts b/test/e2e/app-dir/actions/app-action.test.ts index 6167bd2f5e3a4..6c9d9532a5cd1 100644 --- a/test/e2e/app-dir/actions/app-action.test.ts +++ b/test/e2e/app-dir/actions/app-action.test.ts @@ -114,7 +114,7 @@ createNextDescribe( await check(() => { return browser.eval('window.location.pathname + window.location.search') - }, '/header?name=test&constructor=FormData') + }, '/header?name=test&constructor=FormData&hidden-info=hi') }) it('should support .bind', async () => { diff --git a/test/e2e/app-dir/actions/app/server/form.js b/test/e2e/app-dir/actions/app/server/form.js index 2793a18dd1f79..223e9585763e7 100644 --- a/test/e2e/app-dir/actions/app/server/form.js +++ b/test/e2e/app-dir/actions/app/server/form.js @@ -6,7 +6,9 @@ async function action(formData) { '/header?name=' + formData.get('name') + '&constructor=' + - formData.constructor.name + formData.constructor.name + + '&hidden-info=' + + formData.get('hidden-info') ) } @@ -43,6 +45,7 @@ export default function Form() { <>
+