diff --git a/src/tests/fixtures/form.html b/src/tests/fixtures/form.html index 9b27c95b3..707640393 100644 --- a/src/tests/fixtures/form.html +++ b/src/tests/fixtures/form.html @@ -25,6 +25,10 @@

Form

+
+ + +
@@ -246,6 +250,10 @@

Frame: Form

+
+ + +
diff --git a/src/tests/fixtures/frames/form.html b/src/tests/fixtures/frames/form.html index cc0f0d9e0..021f403ba 100644 --- a/src/tests/fixtures/frames/form.html +++ b/src/tests/fixtures/frames/form.html @@ -7,6 +7,8 @@ +

Frames: Form

+ diff --git a/src/tests/functional/form_submission_tests.js b/src/tests/functional/form_submission_tests.js index 7e6c26073..4480839af 100644 --- a/src/tests/functional/form_submission_tests.js +++ b/src/tests/functional/form_submission_tests.js @@ -599,6 +599,25 @@ test("test submitter POST submission from submitter with data-turbo-frame", asyn assert.equal(await message.textContent(), "Frame redirected") }) +test("test form[data-turbo-frame=_top] submission", async ({ page }) => { + const form = await page.locator("#standard form.redirect[data-turbo-frame=_top]") + + await form.locator("button").click() + await nextEventNamed(page, "turbo:load") + + assert.equal(await page.textContent("h1"), "One") +}) + +test("test form[data-turbo-frame=_top] submission within frame", async ({ page }) => { + const frame = await page.locator("turbo-frame#frame") + const form = await frame.locator("form.redirect[data-turbo-frame=_top]") + + await form.locator("button").click() + await nextEventNamed(page, "turbo:load") + + assert.equal(await page.textContent("h1"), "Frames: Form") +}) + test("test frame form GET submission from submitter with data-turbo-frame=_top", async ({ page }) => { await page.click("#frame form[method=get] [type=submit][data-turbo-frame=_top]") await nextBody(page)