fix(router): disallow component routes with named outlets

Closes #11208, #11082
This commit is contained in:
vsavkin
2016-10-20 15:00:15 -07:00
parent fc60fa790c
commit 8f2fa0f766
3 changed files with 20 additions and 3 deletions

View File

@ -7,6 +7,7 @@
*/
import {validateConfig} from '../src/config';
import {PRIMARY_OUTLET} from '../src/shared';
describe('config', () => {
describe('validateConfig', () => {
@ -80,6 +81,16 @@ describe('config', () => {
.toThrowError(
/Invalid configuration of route 'a': pathMatch can only be set to 'prefix' or 'full'/);
});
it('should throw when pathPatch is invalid', () => {
expect(() => { validateConfig([{path: 'a', outlet: 'aux', children: []}]); })
.toThrowError(
/Invalid route configuration of route 'a': a componentless route cannot have a named outlet set/);
expect(() => validateConfig([{path: 'a', outlet: '', children: []}])).not.toThrow();
expect(() => validateConfig([{path: 'a', outlet: PRIMARY_OUTLET, children: []}]))
.not.toThrow();
});
});
});