fix($parse): correctly assign expressions who's path is undefined and that use brackets notation

Closes #8039
This commit is contained in:
rodyhaddad
2014-07-08 14:54:44 -07:00
parent 494c8aa0b3
commit 60366c8d0b
2 changed files with 23 additions and 4 deletions

View File

@@ -1089,6 +1089,22 @@ describe('parser', function() {
fn.assign(scope, 123);
expect(scope).toEqual({a:123});
}));
it('should expose working assignment function for expressions ending with brackets', inject(function($parse) {
var fn = $parse('a.b["c"]');
expect(fn.assign).toBeTruthy();
var scope = {};
fn.assign(scope, 123);
expect(scope.a.b.c).toEqual(123);
}));
it('should expose working assignment function for expressions with brackets in the middle', inject(function($parse) {
var fn = $parse('a["b"].c');
expect(fn.assign).toBeTruthy();
var scope = {};
fn.assign(scope, 123);
expect(scope.a.b.c).toEqual(123);
}));
});