mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 13:48:13 +00:00
test: only log on /page-load-hook
route
This commit is contained in:
parent
9e83d05e17
commit
2984d3f66a
@ -1582,7 +1582,7 @@ describe('nested suspense', () => {
|
||||
const first = start.match(/\/suspense\/(?<parentType>a?sync)-(?<parentNum>\d)\/(?<childType>a?sync)-(?<childNum>\d)\//)!.groups!
|
||||
const last = nav.match(/\/suspense\/(?<parentType>a?sync)-(?<parentNum>\d)\/(?<childType>a?sync)-(?<childNum>\d)\//)!.groups!
|
||||
|
||||
expect(consoleLogs.map(l => l.text).filter(i => !i.includes('page:loading:end') && !i.includes('[vite]') && !i.includes('<Suspense> is an experimental feature')).sort()).toEqual([
|
||||
expect(consoleLogs.map(l => l.text).filter(i => !i.includes('[vite]') && !i.includes('<Suspense> is an experimental feature')).sort()).toEqual([
|
||||
// [first load] from parent
|
||||
`[${first.parentType}]`,
|
||||
...first.parentType === 'async' ? ['[async] running async data'] : [],
|
||||
@ -1624,7 +1624,7 @@ describe('nested suspense', () => {
|
||||
|
||||
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, nav)
|
||||
|
||||
expect(consoleLogs.map(l => l.text).filter(i => !i.includes('page:loading:end') && !i.includes('[vite]') && !i.includes('<Suspense> is an experimental feature')).sort()).toEqual([
|
||||
expect(consoleLogs.map(l => l.text).filter(i => !i.includes('[vite]') && !i.includes('<Suspense> is an experimental feature')).sort()).toEqual([
|
||||
// [first load] from parent
|
||||
`[${first.parentType}]`,
|
||||
...first.parentType === 'async' ? ['[async] running async data'] : [],
|
||||
@ -1660,7 +1660,7 @@ describe('nested suspense', () => {
|
||||
const first = start.match(/\/suspense\/(?<parentType>a?sync)-(?<parentNum>\d)\//)!.groups!
|
||||
const last = nav.match(/\/suspense\/(?<parentType>a?sync)-(?<parentNum>\d)\/(?<childType>a?sync)-(?<childNum>\d)\//)!.groups!
|
||||
|
||||
expect(consoleLogs.map(l => l.text).filter(i => !i.includes('page:loading:end') && !i.includes('[vite]') && !i.includes('<Suspense> is an experimental feature')).sort()).toEqual([
|
||||
expect(consoleLogs.map(l => l.text).filter(i => !i.includes('[vite]') && !i.includes('<Suspense> is an experimental feature')).sort()).toEqual([
|
||||
// [first load] from parent
|
||||
`[${first.parentType}]`,
|
||||
...first.parentType === 'async' ? ['[async] running async data'] : [],
|
||||
|
3
test/fixtures/basic/pages/index.vue
vendored
3
test/fixtures/basic/pages/index.vue
vendored
@ -94,6 +94,9 @@
|
||||
<NuxtLink to="/server-page">
|
||||
to server page
|
||||
</NuxtLink>
|
||||
<NuxtLink to="/page-load-hook">
|
||||
to page load hook
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const route = useRoute()
|
||||
nuxtApp.hook('page:loading:end', () => {
|
||||
console.log('page:loading:end')
|
||||
if (route.path === '/page-load-hook') {
|
||||
console.log('page:loading:end')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user