fix(router): disallow component routes with named outlets
Closes #11208, #11082
This commit is contained in:
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user