mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-21 21:25:11 +00:00
test: update fixture
This commit is contained in:
parent
faedfdffd9
commit
671c56b669
@ -13,13 +13,18 @@ export default defineNuxtModule({
|
|||||||
name: 'page-extend',
|
name: 'page-extend',
|
||||||
path: '/page-extend',
|
path: '/page-extend',
|
||||||
file: resolver.resolve('../runtime/page.vue'),
|
file: resolver.resolve('../runtime/page.vue'),
|
||||||
}, {
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
nuxt.hook('pages:resolved', (pages) => {
|
||||||
|
pages.push({
|
||||||
path: '/big-page-1',
|
path: '/big-page-1',
|
||||||
file: resolver.resolve('./pages/big-page.vue'),
|
file: resolver.resolve('./pages/big-page.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
layout: false,
|
layout: false,
|
||||||
},
|
},
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
path: '/big-page-2',
|
path: '/big-page-2',
|
||||||
file: resolver.resolve('./pages/big-page.vue'),
|
file: resolver.resolve('./pages/big-page.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
|
4
test/fixtures/basic/nuxt.config.ts
vendored
4
test/fixtures/basic/nuxt.config.ts
vendored
@ -149,7 +149,7 @@ export default defineNuxtConfig({
|
|||||||
_layout: page.meta?.layout,
|
_layout: page.meta?.layout,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
nuxt.hook('pages:extend', (pages) => {
|
nuxt.hook('pages:resolved', (pages) => {
|
||||||
const newPages = []
|
const newPages = []
|
||||||
for (const page of pages) {
|
for (const page of pages) {
|
||||||
if (routesToDuplicate.includes(page.path)) {
|
if (routesToDuplicate.includes(page.path)) {
|
||||||
@ -162,7 +162,7 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
function (_options, nuxt) {
|
function (_options, nuxt) {
|
||||||
// to check that page metadata is preserved
|
// to check that page metadata is preserved
|
||||||
nuxt.hook('pages:extend', (pages) => {
|
nuxt.hook('pages:resolved', (pages) => {
|
||||||
const customName = pages.find(page => page.name === 'some-custom-name')
|
const customName = pages.find(page => page.name === 'some-custom-name')
|
||||||
if (!customName) { throw new Error('Page with custom name not found') }
|
if (!customName) { throw new Error('Page with custom name not found') }
|
||||||
if (customName.path !== '/some-custom-path') { throw new Error('Page path not extracted') }
|
if (customName.path !== '/some-custom-path') { throw new Error('Page path not extracted') }
|
||||||
|
Loading…
Reference in New Issue
Block a user