@@ -28,10 +28,10 @@ describe('component: Type', () => {
2828 } ;
2929 const routerMock = {
3030 resolve : jest . fn ( ( route ) => {
31- return { fullPath : route } ;
31+ return { fullPath : route , path : route } ;
3232 } )
3333 } ;
34- const routeMock = { fullPath : 'route' } ;
34+ const routeMock = { fullPath : 'route' , path : 'route' } ;
3535
3636 describe ( 'should pass props correctly' , ( ) => {
3737 it ( 'should forward Type props to router-link' , ( ) => {
@@ -104,7 +104,7 @@ describe('component: Type', () => {
104104 directives : { cleanHtml : ( identity ) => identity } ,
105105
106106 mocks : {
107- $store : storeMock , $router : routerMock , $route : { fullPath : 'bad' }
107+ $store : storeMock , $router : routerMock , $route : { fullPath : 'bad' , path : 'bad' }
108108 } ,
109109 stubs : { routerLink : createChildRenderingRouterLinkStub ( ) } ,
110110 } ,
@@ -152,6 +152,23 @@ describe('component: Type', () => {
152152
153153 expect ( elementWithSelector . exists ( ) ) . toBe ( false ) ;
154154 } ) ;
155+ it ( 'should use active and exact active classes when route matches but includes query and hash' , ( ) => {
156+ const wrapper = shallowMount ( Type as any , {
157+ props : { type : defaultRouteTypeProp , highlightRoute : true } ,
158+
159+ global : {
160+ directives : { cleanHtml : ( identity ) => identity } ,
161+
162+ mocks : {
163+ $store : storeMock , $router : routerMock , $route : { fullPath : 'route?repo=test#myhash' , path : 'route' }
164+ } ,
165+ stubs : { routerLink : createChildRenderingRouterLinkStub ( { isExactActive : true } ) } ,
166+ } ,
167+ } ) ;
168+
169+ expect ( wrapper . find ( `.${ activeClass } ` ) . exists ( ) ) . toBe ( true ) ;
170+ expect ( wrapper . find ( `.${ exactActiveClass } ` ) . exists ( ) ) . toBe ( true ) ;
171+ } ) ;
155172 } ) ;
156173
157174 describe ( 'should use classes if preconditions are met' , ( ) => {
0 commit comments