File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed
packages/router/src/unplugin/core Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1161,6 +1161,25 @@ describe('Tree', () => {
11611161 )
11621162 } )
11631163
1164+ it ( 'treats _parent nodes as non matchable' , ( ) => {
1165+ const tree = new PrefixTree ( RESOLVED_OPTIONS )
1166+ tree . insert ( 'admin/_parent' , 'admin/_parent.vue' )
1167+
1168+ const admin = tree . children . get ( 'admin' ) !
1169+ expect ( admin . name ) . toBe ( false )
1170+ expect ( admin . isMatchable ( ) ) . toBe ( false )
1171+ } )
1172+
1173+ it ( 'honors explicit name overrides for _parent' , ( ) => {
1174+ const tree = new PrefixTree ( RESOLVED_OPTIONS )
1175+ const admin = tree . insert ( 'admin/_parent' , 'admin/_parent.vue' )
1176+ admin . setCustomRouteBlock ( 'admin/_parent.vue' , { name : 'Admin' } )
1177+
1178+ expect ( admin . name ) . toBe ( 'Admin' )
1179+ expect ( admin . isNamed ( ) ) . toBe ( true )
1180+ expect ( admin . isMatchable ( ) ) . toBe ( true )
1181+ } )
1182+
11641183 it ( 'removes _parent.vue correctly' , ( ) => {
11651184 const tree = new PrefixTree ( RESOLVED_OPTIONS )
11661185 tree . insert ( 'admin/_parent' , 'admin/_parent.vue' )
Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ export class TreeNode {
9292
9393 // Handle _parent convention: _parent.vue sets component on current node
9494 if ( segment === '_parent' && ! tail ) {
95+ this . value . setOverride ( filePath , { name : false } )
9596 this . value . components . set ( viewName , filePath )
9697 return this
9798 }
You can’t perform that action at this time.
0 commit comments