@@ -70,25 +70,27 @@ describe('MenuProviderService', () => {
7070
7171
7272 const persistentProvider1 = new TestMenuProvider ( MenuID . PUBLIC , true , 'provider1' , 0 , undefined , undefined , false , [ section ] ) ;
73- const persistentProvider2 = new TestMenuProvider ( MenuID . PUBLIC , true , 'provider2' , 1 , undefined , 'provider1' , false , [ section ] ) ;
73+ const persistentProvider2 = new TestMenuProvider ( MenuID . PUBLIC , true , 'provider2' , 1 , undefined , 'provider1' , false , [ section , section ] ) ;
7474 const nonPersistentProvider3 = new TestMenuProvider ( MenuID . PUBLIC , false , 'provider3' , 2 , undefined , undefined , false , [ section ] ) ;
7575 const nonPersistentProvider4 = new TestMenuProvider ( MenuID . PUBLIC , false , 'provider4' , 3 , undefined , 'provider3' , false , [ section ] ) ;
7676 const nonPersistentProvider5WithRoutes = new TestMenuProvider ( MenuID . PUBLIC , false , 'provider4' , 3 , [ MenuRoute . SIMPLE_COMMUNITY_PAGE , MenuRoute . SIMPLE_COLLECTION_PAGE ] , undefined , false , [ section ] ) ;
7777
7878 const listOfProvider = [ persistentProvider1 , persistentProvider2 , nonPersistentProvider3 , nonPersistentProvider4 , nonPersistentProvider5WithRoutes ] ;
7979
8080 const expectedSection1 = generateAddedSection ( persistentProvider1 , section ) ;
81- const expectedSection2 = generateAddedSection ( persistentProvider2 , section ) ;
81+ const expectedSection21 = generateAddedSection ( persistentProvider2 , section ) ;
82+ const expectedSection22 = generateAddedSection ( persistentProvider2 , section , 1 ) ;
8283 const expectedSection3 = generateAddedSection ( nonPersistentProvider3 , section ) ;
8384 const expectedSection4 = generateAddedSection ( nonPersistentProvider4 , section ) ;
8485 const expectedSection5 = generateAddedSection ( nonPersistentProvider5WithRoutes , section ) ;
8586
86- function generateAddedSection ( provider , sectionToAdd ) {
87+ function generateAddedSection ( provider , sectionToAdd , index = 0 ) {
8788 return {
8889 ...sectionToAdd ,
89- id : sectionToAdd . id ?? `${ provider . menuProviderId } ` ,
90+ id : sectionToAdd . id ?? `${ provider . menuProviderId } _ ${ index } ` ,
9091 parentID : sectionToAdd . parentID ?? provider . parentID ,
9192 index : sectionToAdd . index ?? provider . index ,
93+ active : false ,
9294 shouldPersistOnRouteChange : sectionToAdd . shouldPersistOnRouteChange ?? provider . shouldPersistOnRouteChange ,
9395 alwaysRenderExpandable : sectionToAdd . alwaysRenderExpandable ?? provider . alwaysRenderExpandable ,
9496 } ;
@@ -115,7 +117,8 @@ describe('MenuProviderService', () => {
115117 menuProviderService . initPersistentMenus ( ) ;
116118
117119 expect ( menuService . addSection ) . toHaveBeenCalledWith ( persistentProvider1 . menuID , expectedSection1 ) ;
118- expect ( menuService . addSection ) . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection2 ) ;
120+ expect ( menuService . addSection ) . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection21 ) ;
121+ expect ( menuService . addSection ) . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection22 ) ;
119122 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( nonPersistentProvider3 . menuID , expectedSection3 ) ;
120123 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( nonPersistentProvider4 . menuID , expectedSection4 ) ;
121124 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( nonPersistentProvider5WithRoutes . menuID , expectedSection5 ) ;
@@ -133,7 +136,8 @@ describe('MenuProviderService', () => {
133136 expect ( menuService . removeSection ) . toHaveBeenCalledWith ( MenuID . DSO_EDIT , sectionToBeRemoved . id ) ;
134137
135138 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider1 . menuID , expectedSection1 ) ;
136- expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection2 ) ;
139+ expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection21 ) ;
140+ expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection22 ) ;
137141 expect ( menuService . addSection ) . toHaveBeenCalledWith ( nonPersistentProvider3 . menuID , expectedSection3 ) ;
138142 expect ( menuService . addSection ) . toHaveBeenCalledWith ( nonPersistentProvider4 . menuID , expectedSection4 ) ;
139143 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( nonPersistentProvider5WithRoutes . menuID , expectedSection5 ) ;
@@ -151,7 +155,8 @@ describe('MenuProviderService', () => {
151155 expect ( menuService . removeSection ) . toHaveBeenCalledWith ( MenuID . DSO_EDIT , sectionToBeRemoved . id ) ;
152156
153157 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider1 . menuID , expectedSection1 ) ;
154- expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection2 ) ;
158+ expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection21 ) ;
159+ expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection22 ) ;
155160 expect ( menuService . addSection ) . toHaveBeenCalledWith ( nonPersistentProvider3 . menuID , expectedSection3 ) ;
156161 expect ( menuService . addSection ) . toHaveBeenCalledWith ( nonPersistentProvider4 . menuID , expectedSection4 ) ;
157162 expect ( menuService . addSection ) . toHaveBeenCalledWith ( nonPersistentProvider5WithRoutes . menuID , expectedSection5 ) ;
@@ -167,7 +172,8 @@ describe('MenuProviderService', () => {
167172 expect ( menuService . removeSection ) . toHaveBeenCalledWith ( MenuID . DSO_EDIT , sectionToBeRemoved . id ) ;
168173
169174 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider1 . menuID , expectedSection1 ) ;
170- expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection2 ) ;
175+ expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection21 ) ;
176+ expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( persistentProvider2 . menuID , expectedSection22 ) ;
171177 expect ( menuService . addSection ) . toHaveBeenCalledWith ( nonPersistentProvider3 . menuID , expectedSection3 ) ;
172178 expect ( menuService . addSection ) . toHaveBeenCalledWith ( nonPersistentProvider4 . menuID , expectedSection4 ) ;
173179 expect ( menuService . addSection ) . not . toHaveBeenCalledWith ( nonPersistentProvider5WithRoutes . menuID , expectedSection5 ) ;
0 commit comments