From c3eacbc25be112adf8663f4c662dcf87bdcc5bcf Mon Sep 17 00:00:00 2001 From: Stephen Mitchell Date: Mon, 8 Jan 2024 11:51:44 -0500 Subject: [PATCH 1/7] Update page_view.js --- src/core/drive/page_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/drive/page_view.js b/src/core/drive/page_view.js index 1583f25a0..6a40a94d9 100644 --- a/src/core/drive/page_view.js +++ b/src/core/drive/page_view.js @@ -16,7 +16,7 @@ export class PageView extends View { } renderPage(snapshot, isPreview = false, willRender = true, visit) { - const shouldMorphPage = this.isPageRefresh(visit) && this.snapshot.shouldMorphPage + const shouldMorphPage = this.isPageRefresh(visit) && snapshot.shouldMorphPage const rendererClass = shouldMorphPage ? MorphRenderer : PageRenderer const renderer = new rendererClass(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender) From 497cdc00d55f372479f5a53a4e4ca5081b2c04bd Mon Sep 17 00:00:00 2001 From: Stephen Mitchell Date: Thu, 11 Jan 2024 12:18:38 -0500 Subject: [PATCH 2/7] Update page_view.js --- src/core/drive/page_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/drive/page_view.js b/src/core/drive/page_view.js index 6a40a94d9..b50dfa245 100644 --- a/src/core/drive/page_view.js +++ b/src/core/drive/page_view.js @@ -16,7 +16,7 @@ export class PageView extends View { } renderPage(snapshot, isPreview = false, willRender = true, visit) { - const shouldMorphPage = this.isPageRefresh(visit) && snapshot.shouldMorphPage + const shouldMorphPage = this.isPageRefresh(visit) && snapshot.shouldMorphPage && this.snapshot.shouldMorphPage const rendererClass = shouldMorphPage ? MorphRenderer : PageRenderer const renderer = new rendererClass(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender) From 6ae4ba66f060c0c2e1b7ffc712d25bad5372dcec Mon Sep 17 00:00:00 2001 From: Stephen Mitchell Date: Mon, 5 Feb 2024 11:52:01 -0500 Subject: [PATCH 3/7] Adds 422 page for morphing test --- src/tests/fixtures/422_morph.html | 16 ++++++++++++++++ src/tests/fixtures/page_refresh.html | 2 +- src/tests/server.mjs | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 src/tests/fixtures/422_morph.html diff --git a/src/tests/fixtures/422_morph.html b/src/tests/fixtures/422_morph.html new file mode 100644 index 000000000..d87ec4161 --- /dev/null +++ b/src/tests/fixtures/422_morph.html @@ -0,0 +1,16 @@ + + + + + + Unprocessable Entity + + + +

Unprocessable Entity

+ + +

Frame: Unprocessable Entity

+
+ + diff --git a/src/tests/fixtures/page_refresh.html b/src/tests/fixtures/page_refresh.html index 0dad87edb..0018b2571 100644 --- a/src/tests/fixtures/page_refresh.html +++ b/src/tests/fixtures/page_refresh.html @@ -118,7 +118,7 @@

Element with Stimulus controller

-
+
diff --git a/src/tests/server.mjs b/src/tests/server.mjs index 10eab3abb..76cdaf464 100644 --- a/src/tests/server.mjs +++ b/src/tests/server.mjs @@ -61,6 +61,13 @@ router.post("/reject/tall", (request, response) => { response.status(parseInt(status || "422", 10)).sendFile(fixture) }) +router.post("/reject/morph", (request, response) => { + const { status } = request.body + const fixture = path.join(__dirname, `../../src/tests/fixtures/422_morph.html`) + + response.status(parseInt(status || "422", 10)).sendFile(fixture) +}) + router.post("/reject", (request, response) => { const { status } = request.body const fixture = path.join(__dirname, `../../src/tests/fixtures/${status}.html`) From 0481b67832faa59e26f6c024a15d31e193e6339c Mon Sep 17 00:00:00 2001 From: Stephen Mitchell Date: Sat, 2 Mar 2024 08:05:57 -0500 Subject: [PATCH 4/7] Remove current page check --- src/core/drive/page_view.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/drive/page_view.js b/src/core/drive/page_view.js index b50dfa245..5a3ffbfaf 100644 --- a/src/core/drive/page_view.js +++ b/src/core/drive/page_view.js @@ -16,7 +16,8 @@ export class PageView extends View { } renderPage(snapshot, isPreview = false, willRender = true, visit) { - const shouldMorphPage = this.isPageRefresh(visit) && snapshot.shouldMorphPage && this.snapshot.shouldMorphPage + const shouldMorphPage = this.isPageRefresh(visit) && snapshot.shouldMorphPage; + console.info("shold morph", shouldMorphPage); const rendererClass = shouldMorphPage ? MorphRenderer : PageRenderer const renderer = new rendererClass(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender) From 3ca7d3b767cbc501fed1759d3ea25f027b262f9d Mon Sep 17 00:00:00 2001 From: Stephen Mitchell Date: Sat, 2 Mar 2024 08:47:31 -0500 Subject: [PATCH 5/7] Update page_view.js --- src/core/drive/page_view.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/core/drive/page_view.js b/src/core/drive/page_view.js index 5a3ffbfaf..6a40a94d9 100644 --- a/src/core/drive/page_view.js +++ b/src/core/drive/page_view.js @@ -16,8 +16,7 @@ export class PageView extends View { } renderPage(snapshot, isPreview = false, willRender = true, visit) { - const shouldMorphPage = this.isPageRefresh(visit) && snapshot.shouldMorphPage; - console.info("shold morph", shouldMorphPage); + const shouldMorphPage = this.isPageRefresh(visit) && snapshot.shouldMorphPage const rendererClass = shouldMorphPage ? MorphRenderer : PageRenderer const renderer = new rendererClass(this.snapshot, snapshot, PageRenderer.renderElement, isPreview, willRender) From d0dd41dbd6454d7a36d80bb7e2566021a3f14f61 Mon Sep 17 00:00:00 2001 From: Stephen Mitchell Date: Sat, 2 Mar 2024 09:55:15 -0500 Subject: [PATCH 6/7] Update autofocus_tests.js --- src/tests/functional/autofocus_tests.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tests/functional/autofocus_tests.js b/src/tests/functional/autofocus_tests.js index 011562ceb..0a7f6deb7 100644 --- a/src/tests/functional/autofocus_tests.js +++ b/src/tests/functional/autofocus_tests.js @@ -140,6 +140,7 @@ test("autofocus from a Turbo Stream message does not leak a placeholder [id]", a `) }) await nextBeat() + await nextBeat() // to avoid flakiness assert.ok( await hasSelector(page, "#container-from-stream input:focus"), From dd71cb4876bada09accb4c5b0295c6a7fd4beb9a Mon Sep 17 00:00:00 2001 From: Stephen Mitchell Date: Sat, 2 Mar 2024 09:59:00 -0500 Subject: [PATCH 7/7] Update autofocus_tests.js --- src/tests/functional/autofocus_tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/functional/autofocus_tests.js b/src/tests/functional/autofocus_tests.js index 0a7f6deb7..9c486b2c3 100644 --- a/src/tests/functional/autofocus_tests.js +++ b/src/tests/functional/autofocus_tests.js @@ -140,7 +140,7 @@ test("autofocus from a Turbo Stream message does not leak a placeholder [id]", a `) }) await nextBeat() - await nextBeat() // to avoid flakiness + await nextBeat() // to avoid flakiness assert.ok( await hasSelector(page, "#container-from-stream input:focus"),