@@ -22,11 +22,8 @@ import {RouterTestingModule, SpyNgModuleFactoryLoader} from '../testing';
2222describe ( 'Integration' , ( ) => {
2323 beforeEach ( ( ) => {
2424 TestBed . configureTestingModule ( {
25- imports : [
26- RouterTestingModule . withRoutes (
27- [ { path : '' , component : BlankCmp } , { path : 'simple' , component : SimpleCmp } ] ) ,
28- TestModule
29- ]
25+ imports :
26+ [ RouterTestingModule . withRoutes ( [ { path : 'simple' , component : SimpleCmp } ] ) , TestModule ]
3027 } ) ;
3128 } ) ;
3229
@@ -165,6 +162,29 @@ describe('Integration', () => {
165162 } ) ) ) ;
166163 } ) ;
167164
165+ it ( 'should not error when no url left and no children are matching' ,
166+ fakeAsync ( inject ( [ Router , Location ] , ( router : Router , location : Location ) => {
167+ const fixture = createRoot ( router , RootCmp ) ;
168+
169+ router . resetConfig ( [ {
170+ path : 'team/:id' ,
171+ component : TeamCmp ,
172+ children : [ { path : 'simple' , component : SimpleCmp } ]
173+ } ] ) ;
174+
175+ router . navigateByUrl ( '/team/33/simple' ) ;
176+ advance ( fixture ) ;
177+
178+ expect ( location . path ( ) ) . toEqual ( '/team/33/simple' ) ;
179+ expect ( fixture . nativeElement ) . toHaveText ( 'team 33 [ simple, right: ]' ) ;
180+
181+ router . navigateByUrl ( '/team/33' ) ;
182+ advance ( fixture ) ;
183+
184+ expect ( location . path ( ) ) . toEqual ( '/team/33' ) ;
185+ expect ( fixture . nativeElement ) . toHaveText ( 'team 33 [ , right: ]' ) ;
186+ } ) ) ) ;
187+
168188 it ( 'should work when an outlet is in an ngIf' ,
169189 fakeAsync ( inject ( [ Router , Location ] , ( router : Router , location : Location ) => {
170190 const fixture = createRoot ( router , RootCmp ) ;
@@ -711,13 +731,13 @@ describe('Integration', () => {
711731 expect ( cmp . activations . length ) . toEqual ( 1 ) ;
712732 expect ( cmp . activations [ 0 ] instanceof BlankCmp ) . toBe ( true ) ;
713733
714- router . navigateByUrl ( '/simple' ) ;
734+ router . navigateByUrl ( '/simple' ) . catch ( e => console . log ( e ) ) ;
715735 advance ( fixture ) ;
716736
717737 expect ( cmp . activations . length ) . toEqual ( 2 ) ;
718738 expect ( cmp . activations [ 1 ] instanceof SimpleCmp ) . toBe ( true ) ;
719- expect ( cmp . deactivations . length ) . toEqual ( 2 ) ;
720- expect ( cmp . deactivations [ 1 ] instanceof BlankCmp ) . toBe ( true ) ;
739+ expect ( cmp . deactivations . length ) . toEqual ( 1 ) ;
740+ expect ( cmp . deactivations [ 0 ] instanceof BlankCmp ) . toBe ( true ) ;
721741 } ) ) ;
722742
723743 it ( 'should update url and router state before activating components' ,
0 commit comments