diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 000000000..18e42f133
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/turbo.iml b/.idea/turbo.iml
new file mode 100644
index 000000000..579af63c8
--- /dev/null
+++ b/.idea/turbo.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/observers/form_link_click_observer.js b/src/observers/form_link_click_observer.js
index bb2e68017..b1f0b47d7 100644
--- a/src/observers/form_link_click_observer.js
+++ b/src/observers/form_link_click_observer.js
@@ -20,7 +20,7 @@ export class FormLinkClickObserver {
willFollowLinkToLocation(link, location, originalEvent) {
return (
this.delegate.willSubmitFormLinkToLocation(link, location, originalEvent) &&
- link.hasAttribute("data-turbo-method")
+ link.hasAttribute("data-turbo-method") && link.hasAttribute("data-turbo-stream")
)
}
diff --git a/src/tests/functional/frame_tests.js b/src/tests/functional/frame_tests.js
index ba66c8cc9..bd06f2d15 100644
--- a/src/tests/functional/frame_tests.js
+++ b/src/tests/functional/frame_tests.js
@@ -82,6 +82,19 @@ test("test following a link sets the frame element's [src]", async ({ page }) =>
assert.equal(src.searchParams.get("key"), "value", "[src] attribute encodes query parameters")
})
+test("test following a link doesn't set the frame element's [src] if the link has [data-turbo-stream]", async ({ page }) => {
+ await page.goto("/src/tests/fixtures/form.html")
+
+ const originalSrc = await page.getAttribute("#frame", "src")
+
+ await page.click("#stream-link-get-method-inside-frame")
+ await nextBeat()
+
+ const newSrc = await page.getAttribute("#frame", "src")
+
+ assert.equal(originalSrc, newSrc, "the turbo-frame src should not change after clicking the link")
+})
+
test("test a frame whose src references itself does not infinitely loop", async ({ page }) => {
await page.click("#frame-self")