mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-07 17:16:42 +08:00
fix($parse): correctly assign expressions who's path is undefined and that use brackets notation
Closes #8039
This commit is contained in:
@@ -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);
|
||||
}));
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user