diff options
| author | Misko Hevery | 2010-12-07 11:39:59 -0800 |
|---|---|---|
| committer | Misko Hevery | 2010-12-08 14:20:26 -0800 |
| commit | fa722447f89e0215463cb39dfd1532189057fea8 (patch) | |
| tree | 6b82a971ddad19ac955650eccfcae908f29a5096 /test | |
| parent | 81d10e819eac778d231b6ba06521c9562d0146cf (diff) | |
| download | angular.js-fa722447f89e0215463cb39dfd1532189057fea8.tar.bz2 | |
Fixed failed assignments of form abj[0].name=value
Closes #169
Diffstat (limited to 'test')
| -rw-r--r-- | test/ParserSpec.js | 8 | ||||
| -rw-r--r-- | test/testabilityPatch.js | 2 | ||||
| -rw-r--r-- | test/widgetsSpec.js | 7 |
3 files changed, 17 insertions, 0 deletions
diff --git a/test/ParserSpec.js b/test/ParserSpec.js index 06cec2b3..c26125da 100644 --- a/test/ParserSpec.js +++ b/test/ParserSpec.js @@ -413,4 +413,12 @@ describe('parser', function() { expect(scope.$eval("a=undefined")).not.toBeDefined(); expect(scope.$get("a")).not.toBeDefined(); }); + + it('should allow assignment after array dereference', function(){ + scope = angular.scope(); + scope.obj = [{}]; + scope.$eval('obj[0].name=1'); + expect(scope.obj.name).toBeUndefined(); + expect(scope.obj[0].name).toEqual(1); + }); }); diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index ea5c8ab7..d389ae19 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -13,6 +13,8 @@ if (window.jstestdriver) { } beforeEach(function(){ + // This is to reset parsers global cache of expressions. + compileCache = {}; this.addMatchers({ toBeInvalid: function(){ var element = jqLite(this.actual); diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index ceec2c90..7253c26f 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -41,6 +41,13 @@ describe("widget", function(){ expect(scope.$get('name')).toEqual('Kai'); expect(scope.$get('count')).toEqual(2); }); + + it('should allow complex refernce binding', function(){ + compile('<div ng:init="obj={abc:{}}">'+ + '<input type="Text" name="obj[\'abc\'].name" value="Misko""/>'+ + '</div>'); + expect(scope.obj['abc'].name).toEqual('Misko'); + }); describe("ng:format", function(){ |
