mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-19 23:21:09 +00:00
test: trigger logging with client-side navigation
This commit is contained in:
parent
2984d3f66a
commit
1edb8d2d7a
@ -625,6 +625,17 @@ describe('pages', () => {
|
||||
const html = await $fetch('/prerender/test')
|
||||
expect(html).toContain('should be prerendered: true')
|
||||
})
|
||||
|
||||
it('should trigger page:loading:end only once', async () => {
|
||||
const { page, consoleLogs } = await renderPage('/')
|
||||
|
||||
await page.getByText('to page load hook').click()
|
||||
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, '/page-load-hook')
|
||||
const loadingEndLogs = consoleLogs.filter(c => c.text.includes('page:loading:end'))
|
||||
expect(loadingEndLogs.length).toBe(1)
|
||||
|
||||
await page.close()
|
||||
})
|
||||
})
|
||||
|
||||
describe('nuxt composables', () => {
|
||||
@ -2854,15 +2865,3 @@ describe('namespace access to useNuxtApp', () => {
|
||||
await page.close()
|
||||
})
|
||||
})
|
||||
|
||||
describe('page hook', () => {
|
||||
it('should trigger page:loading:end only once', async () => {
|
||||
const { page, consoleLogs } = await renderPage()
|
||||
await page.goto(url('/page-load-hook'))
|
||||
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, '/page-load-hook')
|
||||
const loadingEndLogs = consoleLogs.filter(c => c.text.includes('page:loading:end'))
|
||||
expect(loadingEndLogs.length).toBe(1)
|
||||
|
||||
await page.close()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user