Skip to content

Commit 25ca9b8

Browse files
committed
test: add test for loading indicator with custom key
1 parent 2ca8d45 commit 25ca9b8

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

test/nuxt/loading-indicator.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,22 @@ describe('page loading indicator', () => {
4141
name: 'page-load-hook-slug',
4242
path: ':slug',
4343
component: defineComponent({
44-
name: '~/pages/page-load-hook/slug.vue',
44+
name: '~/pages/page-load-hook/[slug].vue',
45+
async setup () {
46+
const route = useRoute()
47+
await new Promise<void>((r) => { resolve = r })
48+
return () => h('div', [h('span', 'child'), route.fullPath])
49+
},
50+
}),
51+
},
52+
{
53+
name: 'page-load-hook-custom-key-slug',
54+
path: 'custom-key/:slug',
55+
meta: {
56+
key: to => to.path,
57+
},
58+
component: defineComponent({
59+
name: '~/pages/page-load-hook/custom-key/[slug].vue',
4560
async setup () {
4661
const route = useRoute()
4762
await new Promise<void>((r) => { resolve = r })
@@ -124,6 +139,10 @@ describe('page loading indicator', () => {
124139
</div>"
125140
`)
126141

142+
await expectNavigatesWithLoading('/page-load-hook/custom-key/abc')
143+
await expectNavigatesWithLoading('/page-load-hook/custom-key/abc?1')
144+
await expectNavigatesWithLoading('/page-load-hook/custom-key/def')
145+
127146
el.unmount()
128147
})
129148
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy