mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
test: add route-provider e2e test (#24195)
This commit is contained in:
parent
56147b4a86
commit
9bab21edbc
@ -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
|
// Bug #6592
|
||||||
describe('layout change not load page twice', () => {
|
describe('layout change not load page twice', () => {
|
||||||
const cases = {
|
const cases = {
|
||||||
|
11
test/fixtures/basic/pages/route-provider/index.vue
vendored
Normal file
11
test/fixtures/basic/pages/route-provider/index.vue
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<NuxtPage />
|
||||||
|
<NuxtLink to="/route-provider/foo">
|
||||||
|
foo
|
||||||
|
</NuxtLink>
|
||||||
|
<NuxtLink to="/route-provider/bar">
|
||||||
|
bar
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
</template>
|
14
test/fixtures/basic/pages/route-provider/index/bar.vue
vendored
Normal file
14
test/fixtures/basic/pages/route-provider/index/bar.vue
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const route = useRoute()
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div data-testid="bar">
|
||||||
|
bar: {{ $route.path }} - {{ route.path }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
14
test/fixtures/basic/pages/route-provider/index/foo.vue
vendored
Normal file
14
test/fixtures/basic/pages/route-provider/index/foo.vue
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
const route = useRoute()
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div data-testid="foo">
|
||||||
|
foo: {{ $route.path }} - {{ route.path }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
Loading…
Reference in New Issue
Block a user