mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 23:22:02 +00:00
fix(nuxt3): use path
for uniqueness of routes when resolving (#3895)
This commit is contained in:
parent
e7b57fa34c
commit
e34ed887f2
@ -40,7 +40,7 @@ export async function resolvePagesRoutes (): Promise<NuxtPage[]> {
|
|||||||
})
|
})
|
||||||
)).flat()
|
)).flat()
|
||||||
|
|
||||||
return uniqueBy(allRoutes, 'name')
|
return uniqueBy(allRoutes, 'path')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateRoutesFromFiles (files: string[], pagesDir: string): NuxtPage[] {
|
export function generateRoutesFromFiles (files: string[], pagesDir: string): NuxtPage[] {
|
||||||
|
@ -91,6 +91,16 @@ describe('pages', () => {
|
|||||||
expect(html).toContain('foo: foobar')
|
expect(html).toContain('foo: foobar')
|
||||||
expect(html).toContain('group: admin')
|
expect(html).toContain('group: admin')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('/parent', async () => {
|
||||||
|
const html = await $fetch('/parent')
|
||||||
|
expect(html).toContain('parent/index')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('/another-parent', async () => {
|
||||||
|
const html = await $fetch('/another-parent')
|
||||||
|
expect(html).toContain('another-parent/index')
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('navigate', () => {
|
describe('navigate', () => {
|
||||||
|
6
test/fixtures/basic/pages/another-parent.vue
vendored
Normal file
6
test/fixtures/basic/pages/another-parent.vue
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
another-parent
|
||||||
|
<NuxtPage />
|
||||||
|
</div>
|
||||||
|
</template>
|
5
test/fixtures/basic/pages/another-parent/index.vue
vendored
Normal file
5
test/fixtures/basic/pages/another-parent/index.vue
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
another-parent/index
|
||||||
|
</div>
|
||||||
|
</template>
|
6
test/fixtures/basic/pages/parent.vue
vendored
Normal file
6
test/fixtures/basic/pages/parent.vue
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
parent
|
||||||
|
<NuxtPage />
|
||||||
|
</div>
|
||||||
|
</template>
|
5
test/fixtures/basic/pages/parent/index.vue
vendored
Normal file
5
test/fixtures/basic/pages/parent/index.vue
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
parent/index
|
||||||
|
</div>
|
||||||
|
</template>
|
Loading…
Reference in New Issue
Block a user