From c36bab642cda4e07f5825bf3f3c7e2a0ef07a588 Mon Sep 17 00:00:00 2001 From: TEHEK Firefox Date: Sat, 24 Sep 2011 17:07:30 +0000 Subject: [PATCH] fix($limitTo): properly handle excessive limits Closes #571 --- src/apis.js | 4 +--- test/ApiSpecs.js | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/apis.js b/src/apis.js index b072c088ad23..5636c1fa3634 100644 --- a/src/apis.js +++ b/src/apis.js @@ -714,7 +714,7 @@ var angularArray = { expect(binding('numbers.$limitTo(limit) | json')).toEqual('[1,2,3]'); }); - it('should update the output when -3 is entered', function() { + it('should update the output when -3 is entered', function() { input('limit').enter(-3); expect(binding('numbers.$limitTo(limit) | json')).toEqual('[7,8,9]'); }); @@ -723,8 +723,6 @@ var angularArray = { input('limit').enter(100); expect(binding('numbers.$limitTo(limit) | json')).toEqual('[1,2,3,4,5,6,7,8,9]'); }); - - */ diff --git a/test/ApiSpecs.js b/test/ApiSpecs.js index f97c5862e48a..ef25bb413149 100644 --- a/test/ApiSpecs.js +++ b/test/ApiSpecs.js @@ -186,6 +186,7 @@ describe('api', function(){ expect(angular.Array.limitTo({}, 1)).toEqual([]); }); + it('should return a copy of input array if X is exceeds array length', function () { expect(angular.Array.limitTo(items, 19)).toEqual(items); expect(angular.Array.limitTo(items, '9')).toEqual(items);