aboutsummaryrefslogtreecommitdiff
path: root/packages/astro/e2e/fixtures/view-transitions/src/pages/page-with-persistent-form.astro
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro/e2e/fixtures/view-transitions/src/pages/page-with-persistent-form.astro')
-rw-r--r--packages/astro/e2e/fixtures/view-transitions/src/pages/page-with-persistent-form.astro20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/astro/e2e/fixtures/view-transitions/src/pages/page-with-persistent-form.astro b/packages/astro/e2e/fixtures/view-transitions/src/pages/page-with-persistent-form.astro
new file mode 100644
index 000000000..c150726ed
--- /dev/null
+++ b/packages/astro/e2e/fixtures/view-transitions/src/pages/page-with-persistent-form.astro
@@ -0,0 +1,20 @@
+---
+import Layout from '../components/Layout.astro';
+---
+<Layout>
+ <h2>Form 1</h2>
+ <form transition:persist>
+ <input id="input" type="text" name="name" autocomplete="false"/>
+ </form>
+
+ <script>
+ import {navigate} from "astro:transitions/client"
+ const form = document.querySelector("form");
+ form.addEventListener("submit", (e) => {
+ console.log("submit");
+ e.preventDefault();
+ navigate(`${location.pathname}?name=${input.value}`,{history: "replace"});
+ return false;
+ });
+ </script>
+</Layout>