fix(compiler): throw an error if variable with the same name is already defined. (#7209)
* fix(compiler): throw an error if variable with the same name is already defined. Closes #6492 * fix(compiler): Clean up formatting for issue #6492 * fix(compiler): throw an error if reference with the same name is already defined. Closes #6492
This commit is contained in:

committed by
Miško Hevery

parent
263122ea5f
commit
9036f78b74
@ -822,6 +822,16 @@ There is no directive with "exportAs" set to "dirA" ("<div [ERROR ->]#a="dirA"><
|
||||
"let-" is only supported on template elements. ("<div [ERROR ->]let-a></div>"): TestComp@0:5`);
|
||||
});
|
||||
|
||||
it('should report duplicate reference names', () => {
|
||||
expect(() => parse('<div #a></div><div #a></div>', []))
|
||||
.toThrowError(`Template parse errors:
|
||||
Reference "#a" is defined several times ("<div #a></div><div [ERROR ->]#a></div>"): TestComp@0:19`);
|
||||
});
|
||||
|
||||
it('should not throw error when there is same reference name in different templates', () => {
|
||||
expect(() => parse('<div #a><template #a><span>OK</span></template></div>', [])).not.toThrowError();
|
||||
});
|
||||
|
||||
it('should assign references with empty value to components', () => {
|
||||
var dirA = CompileDirectiveMetadata.create({
|
||||
selector: '[a]',
|
||||
|
Reference in New Issue
Block a user