diff options
| author | Pete Bacon Darwin | 2013-01-11 12:47:38 +0000 |
|---|---|---|
| committer | Igor Minar | 2013-01-17 00:25:07 -0800 |
| commit | ed2fd2d0caad4e4b45f79bb39fd2a8b03fea8faa (patch) | |
| tree | bee7ee236a01f009cc393d5147643c2d03ac3d44 /test/ng/directive/ngRepeatSpec.js | |
| parent | 7c60151cb8ca6ce8fc49846b7ae2f536d0d2cc28 (diff) | |
| download | angular.js-ed2fd2d0caad4e4b45f79bb39fd2a8b03fea8faa.tar.bz2 | |
fix(ngRepeat): correctly apply $last if repeating over object
If the $last property is calculated from the original collectionLength
on an object and properties starting with $ were filtered out, then $last
is never applied and $middle is applied erroniously.
Closes #1789
Diffstat (limited to 'test/ng/directive/ngRepeatSpec.js')
| -rw-r--r-- | test/ng/directive/ngRepeatSpec.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index a45cd972..33e4dcfd 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -293,6 +293,21 @@ describe('ngRepeat', function() { }); + it('should calculate $first, $middle and $last when we filter out properties from an obj', function() { + element = $compile( + '<ul>' + + '<li ng-repeat="(key, val) in items">{{key}}:{{val}}:{{$first}}-{{$middle}}-{{$last}}|</li>' + + '</ul>')(scope); + scope.items = {'misko':'m', 'shyam':'s', 'doug':'d', 'frodo':'f', '$toBeFilteredOut': 'xxxx'}; + scope.$digest(); + expect(element.text()). + toEqual('doug:d:true-false-false|' + + 'frodo:f:false-true-false|' + + 'misko:m:false-true-false|' + + 'shyam:s:false-false-true|'); + }); + + it('should ignore $ and $$ properties', function() { element = $compile('<ul><li ng-repeat="i in items">{{i}}|</li></ul>')(scope); scope.items = ['a', 'b', 'c']; |
