From 7e746015ea7dec3e9eb81bc4678fa9b6a83bc47c Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 11 Jan 2013 12:47:38 +0000 Subject: 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 --- test/ng/directive/ngRepeatSpec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ng') 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( + '')(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('')(scope); scope.items = ['a', 'b', 'c']; -- cgit v1.2.3