fix(parser): detect and report interpolation in expressions
Fixes #3645 Closes #3750
This commit is contained in:
@ -49,6 +49,12 @@ export function main() {
|
||||
expect(process(el('<div [a]v="b"></div>'))[0]).toBe(null);
|
||||
});
|
||||
|
||||
it('should throw when [] binding contains interpolation', () => {
|
||||
expect(() => process(el('<div [a]="a + {{b()}}"></div>'))[0])
|
||||
.toThrowErrorWith(
|
||||
'Got interpolation ({{}}) where expression was expected at column 4 in [a + {{b()}}] in someComponent');
|
||||
});
|
||||
|
||||
it('should detect bind- syntax', () => {
|
||||
var results = process(el('<div bind-a="b"></div>'));
|
||||
expect(results[0].propertyBindings.get('a').source).toEqual('b');
|
||||
@ -157,6 +163,12 @@ export function main() {
|
||||
expect(eventBinding.fullName).toEqual('click');
|
||||
});
|
||||
|
||||
it('should throw when () action contains interpolation', () => {
|
||||
expect(() => process(el('<div (a)="{{b()}}"></div>'))[0])
|
||||
.toThrowErrorWith(
|
||||
'Got interpolation ({{}}) where expression was expected at column 0 in [{{b()}}] in someComponent');
|
||||
});
|
||||
|
||||
it('should detect on- syntax', () => {
|
||||
var results = process(el('<div on-click="b()"></div>'));
|
||||
var eventBinding = results[0].eventBindings[0];
|
||||
|
Reference in New Issue
Block a user