aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive/inputSpec.js
diff options
context:
space:
mode:
authorVojta Jina2012-03-29 13:50:27 -0700
committerVojta Jina2012-03-29 14:05:19 -0700
commit95c5df5958f6d42d08846fa40c10cb279ce76ee9 (patch)
treeaef8880ea2cbc5225ee60e5bee687750cb9937b5 /test/ng/directive/inputSpec.js
parent2cb907a8366e3273890f5ef6174b2e3970cd1720 (diff)
downloadangular.js-95c5df5958f6d42d08846fa40c10cb279ce76ee9.tar.bz2
fix(ngValue): bind properly inside ng-repeat
Diffstat (limited to 'test/ng/directive/inputSpec.js')
-rw-r--r--test/ng/directive/inputSpec.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ng/directive/inputSpec.js b/test/ng/directive/inputSpec.js
index e5f083b3..734cb34d 100644
--- a/test/ng/directive/inputSpec.js
+++ b/test/ng/directive/inputSpec.js
@@ -1115,5 +1115,23 @@ describe('input', function() {
browserTrigger(inputElm, 'click');
expect(scope.selected).toBe(scope.value);
});
+
+
+ it('should work inside ng-repeat', function() {
+ compileInput(
+ '<input type="radio" ng-repeat="i in items" ng-model="$parent.selected" ng-value="i.id">');
+
+ scope.$apply(function() {
+ scope.items = [{id: 1}, {id: 2}];
+ scope.selected = 1;
+ });
+
+ inputElm = formElm.find('input');
+ expect(inputElm[0].checked).toBe(true);
+ expect(inputElm[1].checked).toBe(false);
+
+ browserTrigger(inputElm.eq(1), 'click');
+ expect(scope.selected).toBe(2);
+ });
});
});