fix(router): allow specifying a matcher wihtout specifying a path

fixes #12972
This commit is contained in:
Dzmitry Shylovich
2016-12-02 14:17:27 -08:00
committed by Alex Rickabaugh
parent d7d8fab211
commit bbb7a39414
2 changed files with 11 additions and 6 deletions

View File

@ -16,6 +16,10 @@ describe('config', () => {
() => validateConfig([{path: 'a', redirectTo: 'b'}, {path: 'b', component: ComponentA}]))
.not.toThrow();
});
it('should not throw when a matcher is provided', () => {
expect(() => validateConfig([{matcher: <any>'someFunc', component: ComponentA}]))
.not.toThrow();
});
it('should throw for undefined route', () => {
@ -67,9 +71,9 @@ describe('config', () => {
});
it('should throw when path and matcher are missing', () => {
expect(() => {
validateConfig([{component: null, redirectTo: 'b'}]);
}).toThrowError(`Invalid route configuration: routes must have path specified`);
expect(() => { validateConfig([{component: null, redirectTo: 'b'}]); })
.toThrowError(
`Invalid route configuration: routes must have either a path or a matcher specified`);
});
it('should throw when none of component and children or direct are missing', () => {