From: Eduardo San Martin Morote Date: Tue, 8 Nov 2022 13:15:20 +0000 (+0100) Subject: test: add more tests for 756f755 X-Git-Tag: v4.2.0~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9d640412f1041264ff0d4e507446ae2b8e0bbae0;p=thirdparty%2Fvuejs%2Frouter.git test: add more tests for 756f755 --- diff --git a/packages/router/__tests__/matcher/resolve.spec.ts b/packages/router/__tests__/matcher/resolve.spec.ts index af5392a4..d51622d4 100644 --- a/packages/router/__tests__/matcher/resolve.spec.ts +++ b/packages/router/__tests__/matcher/resolve.spec.ts @@ -1015,7 +1015,7 @@ describe('RouterMatcher.resolve', () => { ) }) - it('avoids nested records with children without a component nor name', () => { + it('avoid deeply nested records with children without a component nor name', () => { assertErrorMatch( { path: '/app', diff --git a/packages/router/__tests__/router.spec.ts b/packages/router/__tests__/router.spec.ts index 340b8c00..9e687111 100644 --- a/packages/router/__tests__/router.spec.ts +++ b/packages/router/__tests__/router.spec.ts @@ -204,6 +204,30 @@ describe('Router', () => { }) }) + it('merges meta properties from component-less route records', async () => { + const { router } = await newRouter() + router.addRoute({ + meta: { parent: true }, + path: '/app', + children: [ + { path: '', component: components.Foo, meta: { child: true } }, + { + path: 'nested', + component: components.Foo, + children: [ + { path: 'a', children: [{ path: 'b', component: components.Foo }] }, + ], + }, + ], + }) + expect(router.resolve('/app')).toMatchObject({ + meta: { parent: true, child: true }, + }) + expect(router.resolve('/app/nested/a/b')).toMatchObject({ + meta: { parent: true }, + }) + }) + it('can do initial navigation to /', async () => { const router = createRouter({ history: createMemoryHistory(),