Skip to content

Commit

Permalink
Add test for hidden form fields at the beginning of a Server Action f…
Browse files Browse the repository at this point in the history
…orm (#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
  • Loading branch information
shuding committed Jun 8, 2023
1 parent 9a9d095 commit b8e308f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/e2e/app-dir/actions/app-action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down
5 changes: 4 additions & 1 deletion test/e2e/app-dir/actions/app/server/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
)
}

Expand Down Expand Up @@ -43,6 +45,7 @@ export default function Form() {
<>
<hr />
<form action={action}>
<input type="text" name="hidden-info" value="hi" hidden />
<input type="text" name="name" id="name" required />
<button type="submit" id="submit">
Submit
Expand Down

0 comments on commit b8e308f

Please sign in to comment.