fix(router): throw an error when navigate to null/undefined path
Closes #10560 Fixes #13384
This commit is contained in:

committed by
Matias Niemelä

parent
8c7e93bebe
commit
46cb04d575
@ -536,6 +536,17 @@ describe('Integration', () => {
|
||||
expect(cmp.recordedParams).toEqual([{name: '1'}]);
|
||||
})));
|
||||
|
||||
it('should throw an error when one of the commands is null/undefined',
|
||||
fakeAsync(inject([Router], (router: Router) => {
|
||||
createRoot(router, RootCmp);
|
||||
|
||||
router.resetConfig([{path: 'query', component: EmptyQueryParamsCmp}]);
|
||||
|
||||
expect(() => router.navigate([
|
||||
undefined, 'query'
|
||||
])).toThrowError(`The requested path contains undefined segment at index 0`);
|
||||
})));
|
||||
|
||||
it('should push params only when they change', fakeAsync(inject([Router], (router: Router) => {
|
||||
const fixture = createRoot(router, RootCmp);
|
||||
|
||||
|
Reference in New Issue
Block a user