@@ -7,7 +7,7 @@ import { waitForAsync } from '@angular/core/testing';
77import { MenuProviderService } from './menu-provider.service' ;
88import { MenuService } from './menu.service' ;
99import { COMMUNITY_MODULE_PATH } from '../../community-page/community-page-routing-paths' ;
10- import { COLLECTION_MODULE_PATH } from '../../collection-page/collection-page-routing-paths ' ;
10+ import { MenuRoute } from './menu-route.model ' ;
1111
1212describe ( 'MenuProviderService' , ( ) => {
1313
@@ -18,7 +18,7 @@ describe('MenuProviderService', () => {
1818 public shouldPersistOnRouteChange : boolean ,
1919 public menuProviderId : string ,
2020 public index : number ,
21- public activePaths : string [ ] ,
21+ public activePaths : MenuRoute [ ] ,
2222 public parentID : string ,
2323 public alwaysRenderExpandable : boolean ,
2424 public sections : PartialMenuSection [ ]
@@ -36,7 +36,12 @@ describe('MenuProviderService', () => {
3636 let menuService : MenuService ;
3737
3838 const router = {
39- events : observableOf ( new ResolveEnd ( 1 , 'test-url' , 'test-url-after-redirect' , { url : 'test-url' , root : { url : [ new UrlSegment ( 'test-url' , { } ) ] } } as any ) )
39+ events : observableOf ( new ResolveEnd ( 1 , 'test-url' , 'test-url-after-redirect' , {
40+ url : 'test-url' ,
41+ root : { url : [ new UrlSegment ( 'test-url' , { } ) ] , data : { }
42+ } ,
43+ data : { }
44+ } as any ) )
4045 } ;
4146
4247 const section = {
@@ -59,7 +64,7 @@ describe('MenuProviderService', () => {
5964 const persistentProvider2 = new TestMenuProvider ( MenuID . PUBLIC , true , 'provider2' , 1 , undefined , 'provider1' , false , [ section ] ) ;
6065 const nonPersistentProvider3 = new TestMenuProvider ( MenuID . PUBLIC , false , 'provider3' , 2 , undefined , undefined , false , [ section ] ) ;
6166 const nonPersistentProvider4 = new TestMenuProvider ( MenuID . PUBLIC , false , 'provider4' , 3 , undefined , 'provider3' , false , [ section ] ) ;
62- const nonPersistentProvider5WithRoutes = new TestMenuProvider ( MenuID . PUBLIC , false , 'provider4' , 3 , [ COMMUNITY_MODULE_PATH , COLLECTION_MODULE_PATH ] , undefined , false , [ section ] ) ;
67+ const nonPersistentProvider5WithRoutes = new TestMenuProvider ( MenuID . PUBLIC , false , 'provider4' , 3 , [ MenuRoute . SIMPLE_COMMUNITY_PAGE , MenuRoute . SIMPLE_COLLECTION_PAGE , ] , undefined , false , [ section ] ) ;
6368
6469 const listOfProvider = [ persistentProvider1 , persistentProvider2 , nonPersistentProvider3 , nonPersistentProvider4 , nonPersistentProvider5WithRoutes ] ;
6570
@@ -110,7 +115,7 @@ describe('MenuProviderService', () => {
110115
111116 describe ( 'resolveRouteMenus with no matching path specific providers' , ( ) => {
112117 it ( 'should remove the current non persistent menus and add the general non persistent menus' , ( ) => {
113- const route = { } ;
118+ const route = { data : { } } ;
114119 const state = { url : 'test-url' } ;
115120 menuProviderService . resolveRouteMenus ( route as any , state as any ) . subscribe ( ) ;
116121
@@ -128,7 +133,7 @@ describe('MenuProviderService', () => {
128133
129134 describe ( 'resolveRouteMenus with a matching path specific provider' , ( ) => {
130135 it ( 'should remove the current non persistent menus and add the general non persistent menus' , ( ) => {
131- const route = { } ;
136+ const route = { data : { menuRoute : MenuRoute . SIMPLE_COMMUNITY_PAGE } } ;
132137 const state = { url : `xxxx/${ COMMUNITY_MODULE_PATH } /xxxxxx` } ;
133138 menuProviderService . resolveRouteMenus ( route as any , state as any ) . subscribe ( ) ;
134139
0 commit comments