Skip to content

Commit 9d64041

Browse files
committed
test: add more tests for 756f755
1 parent dfdf867 commit 9d64041

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

packages/router/__tests__/matcher/resolve.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ describe('RouterMatcher.resolve', () => {
10151015
)
10161016
})
10171017

1018-
it('avoids nested records with children without a component nor name', () => {
1018+
it('avoid deeply nested records with children without a component nor name', () => {
10191019
assertErrorMatch(
10201020
{
10211021
path: '/app',

packages/router/__tests__/router.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,30 @@ describe('Router', () => {
204204
})
205205
})
206206

207+
it('merges meta properties from component-less route records', async () => {
208+
const { router } = await newRouter()
209+
router.addRoute({
210+
meta: { parent: true },
211+
path: '/app',
212+
children: [
213+
{ path: '', component: components.Foo, meta: { child: true } },
214+
{
215+
path: 'nested',
216+
component: components.Foo,
217+
children: [
218+
{ path: 'a', children: [{ path: 'b', component: components.Foo }] },
219+
],
220+
},
221+
],
222+
})
223+
expect(router.resolve('/app')).toMatchObject({
224+
meta: { parent: true, child: true },
225+
})
226+
expect(router.resolve('/app/nested/a/b')).toMatchObject({
227+
meta: { parent: true },
228+
})
229+
})
230+
207231
it('can do initial navigation to /', async () => {
208232
const router = createRouter({
209233
history: createMemoryHistory(),

0 commit comments

Comments
 (0)