@@ -22,11 +22,8 @@ import {RouterTestingModule, SpyNgModuleFactoryLoader} from '../testing';
22
22
describe ( 'Integration' , ( ) => {
23
23
beforeEach ( ( ) => {
24
24
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 ]
30
27
} ) ;
31
28
} ) ;
32
29
@@ -165,6 +162,29 @@ describe('Integration', () => {
165
162
} ) ) ) ;
166
163
} ) ;
167
164
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
+
168
188
it ( 'should work when an outlet is in an ngIf' ,
169
189
fakeAsync ( inject ( [ Router , Location ] , ( router : Router , location : Location ) => {
170
190
const fixture = createRoot ( router , RootCmp ) ;
@@ -711,13 +731,13 @@ describe('Integration', () => {
711
731
expect ( cmp . activations . length ) . toEqual ( 1 ) ;
712
732
expect ( cmp . activations [ 0 ] instanceof BlankCmp ) . toBe ( true ) ;
713
733
714
- router . navigateByUrl ( '/simple' ) ;
734
+ router . navigateByUrl ( '/simple' ) . catch ( e => console . log ( e ) ) ;
715
735
advance ( fixture ) ;
716
736
717
737
expect ( cmp . activations . length ) . toEqual ( 2 ) ;
718
738
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 ) ;
721
741
} ) ) ;
722
742
723
743
it ( 'should update url and router state before activating components' ,
0 commit comments