fix(compiler): support empty array and map literals.

This was broken after 152a117d5c

Fixes #8336
This commit is contained in:
Tobias Bosch
2016-04-29 10:43:26 -07:00
parent 5ff31f0713
commit 11955f9b13
4 changed files with 31 additions and 0 deletions

View File

@ -371,6 +371,12 @@ export function main() {
expect(renderLog.loggedValues).toEqual([[1, 2]]);
}));
it('should support empty literal array', fakeAsync(() => {
var ctx = _bindSimpleValue('[]');
ctx.detectChanges(false);
expect(renderLog.loggedValues).toEqual([[]]);
}));
it('should support literal array made of expressions', fakeAsync(() => {
var ctx = _bindSimpleValue('[1, a]', TestData);
ctx.componentInstance.a = 2;
@ -395,6 +401,12 @@ export function main() {
expect(renderLog.loggedValues[0]['z']).toEqual(1);
}));
it('should support empty literal map', fakeAsync(() => {
var ctx = _bindSimpleValue('{}');
ctx.detectChanges(false);
expect(renderLog.loggedValues).toEqual([{}]);
}));
it('should support literal maps made of expressions', fakeAsync(() => {
var ctx = _bindSimpleValue('{z: a}');
ctx.componentInstance.a = 1;