aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ParserSpec.js8
-rw-r--r--test/testabilityPatch.js2
-rw-r--r--test/widgetsSpec.js7
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(){