From 9bab21edbc9e944309d12377ade0e6fe5f8c97fd Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Thu, 9 Nov 2023 03:21:19 +0000 Subject: [PATCH] test: add route-provider e2e test (#24195) --- test/basic.test.ts | 11 +++++++++++ test/fixtures/basic/pages/route-provider/index.vue | 11 +++++++++++ .../basic/pages/route-provider/index/bar.vue | 14 ++++++++++++++ .../basic/pages/route-provider/index/foo.vue | 14 ++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 test/fixtures/basic/pages/route-provider/index.vue create mode 100644 test/fixtures/basic/pages/route-provider/index/bar.vue create mode 100644 test/fixtures/basic/pages/route-provider/index/foo.vue diff --git a/test/basic.test.ts b/test/basic.test.ts index 3aa9526f5e..d4386c9086 100644 --- a/test/basic.test.ts +++ b/test/basic.test.ts @@ -1291,6 +1291,17 @@ describe('page key', () => { }) }) +describe('route provider', () => { + it('should preserve current route when navigation is suspended', async () => { + const { page } = await renderPage('/route-provider/foo') + await page.click('[href="/route-provider/bar"]') + expect(await page.getByTestId('foo').innerText()).toMatchInlineSnapshot('"foo: /route-provider/foo - /route-provider/foo"') + expect(await page.getByTestId('bar').innerText()).toMatchInlineSnapshot('"bar: /route-provider/bar - /route-provider/bar"') + + await page.close() + }) +}) + // Bug #6592 describe('layout change not load page twice', () => { const cases = { diff --git a/test/fixtures/basic/pages/route-provider/index.vue b/test/fixtures/basic/pages/route-provider/index.vue new file mode 100644 index 0000000000..34b99200b7 --- /dev/null +++ b/test/fixtures/basic/pages/route-provider/index.vue @@ -0,0 +1,11 @@ + diff --git a/test/fixtures/basic/pages/route-provider/index/bar.vue b/test/fixtures/basic/pages/route-provider/index/bar.vue new file mode 100644 index 0000000000..425b5d3428 --- /dev/null +++ b/test/fixtures/basic/pages/route-provider/index/bar.vue @@ -0,0 +1,14 @@ + + + + + diff --git a/test/fixtures/basic/pages/route-provider/index/foo.vue b/test/fixtures/basic/pages/route-provider/index/foo.vue new file mode 100644 index 0000000000..cc6f3268a7 --- /dev/null +++ b/test/fixtures/basic/pages/route-provider/index/foo.vue @@ -0,0 +1,14 @@ + + + + +