Skip to content

Commit

Permalink
test: add regression test for nested page from nuxt#25039
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Nov 30, 2024
1 parent 17e55cf commit 435193f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
6 changes: 3 additions & 3 deletions test/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,9 @@ describe('pages', () => {

it('should hide nuxt page load indicator after navigate back from nested page', async () => {
const LOAD_INDICATOR_SELECTOR = '.nuxt-loading-indicator'
const { page } = await renderPage('/')
await page.getByText('to page nuxt load indicator').click()
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, '/nested/xyz')
const { page } = await renderPage('/page-load-hook')
await page.getByText('To sub page').click()
await page.waitForFunction(path => window.useNuxtApp?.()._route.fullPath === path, '/page-load-hook/subpage')

await page.waitForSelector(LOAD_INDICATOR_SELECTOR)
let isVisible = await page.isVisible(LOAD_INDICATOR_SELECTOR)
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/basic/app.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<template>
<NuxtLoadingIndicator :throttle="0" />
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</template>
1 change: 0 additions & 1 deletion test/fixtures/basic/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<Head>
<Title>Basic fixture</Title>
</Head>
<NuxtLoadingIndicator :throttle="0" />
<h1>Hello Nuxt 3!</h1>
<div>RuntimeConfig | testConfig: {{ config.public.testConfig }}</div>
<div>Composable | foo: {{ foo }}</div>
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/basic/pages/page-load-hook.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<template>
<div>
Page for hook tests.
<NuxtLink to="/page-load-hook/subpage">
To sub page
</NuxtLink>
<NuxtPage />
</div>
</template>
7 changes: 7 additions & 0 deletions test/fixtures/basic/pages/page-load-hook/[slug].vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<template>
<div>
<NuxtLink to="/page-load-hook">
Back to parent
</NuxtLink>
</div>
</template>

0 comments on commit 435193f

Please sign in to comment.