fix(compiler): throw when a component defines both template and templateUrl (#15572)

Closes #15566
This commit is contained in:
Dzmitry Shylovich
2017-03-29 20:26:48 +03:00
committed by Victor Berchet
parent d58a242fe7
commit 9c77a7cdaf
2 changed files with 14 additions and 0 deletions

View File

@ -51,6 +51,16 @@ export function main() {
templateUrl: <any>{}
})).toThrowError('The templateUrl specified for component SomeComp is not a string');
}));
it('should throw if both template and templateUrl are defined',
inject([DirectiveNormalizer], (normalizer: DirectiveNormalizer) => {
expect(() => normalizer.normalizeTemplate({
ngModuleType: null,
componentType: SomeComp,
moduleUrl: SOME_MODULE_URL,
template: '',
templateUrl: '',
})).toThrowError(`'SomeComp' component cannot define both template and templateUrl`);
}));
});
describe('normalizeTemplateSync', () => {