aboutsummaryrefslogtreecommitdiffstats
path: root/test/ApiSpecs.js
diff options
context:
space:
mode:
authorMisko Hevery2011-06-20 13:50:46 -0700
committerIgor Minar2011-06-23 08:12:01 -0700
commitb74163dc1d321b878222a751f23adb0a9f6beda5 (patch)
treee42f66a63caadf94c4bd74530062cc5deee6469b /test/ApiSpecs.js
parentbad62d87a1785f11b0df72ad597b9064517997cf (diff)
downloadangular.js-b74163dc1d321b878222a751f23adb0a9f6beda5.tar.bz2
fix:$orderBy - return unsorted array if no predicate
Closes #399
Diffstat (limited to 'test/ApiSpecs.js')
-rw-r--r--test/ApiSpecs.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/ApiSpecs.js b/test/ApiSpecs.js
index 2fd51873..f50f22cd 100644
--- a/test/ApiSpecs.js
+++ b/test/ApiSpecs.js
@@ -160,15 +160,14 @@ describe('api', function(){
});
describe('orderBy', function(){
- var orderBy = angular.Array.orderBy;
-
- it('ShouldSortArray', function(){
- assertEquals([2,15], angular.Array.orderBy([15,2]));
- assertEquals(["a","B", "c"], angular.Array.orderBy(["c","B", "a"]));
- assertEquals([15,"2"], angular.Array.orderBy([15,"2"]));
- assertEquals(["15","2"], angular.Array.orderBy(["15","2"]));
- assertJsonEquals([{a:2},{a:15}], angular.Array.orderBy([{a:15},{a:2}], 'a'));
- assertJsonEquals([{a:2},{a:15}], angular.Array.orderBy([{a:15},{a:2}], 'a', "F"));
+ var orderBy;
+ beforeEach(function(){
+ orderBy = angular.Array.orderBy;
+ });
+
+ it('should return same array if predicate is falsy', function(){
+ var array = [1, 2, 3];
+ expect(orderBy(array)).toBe(array);
});
it('ShouldSortArrayInReverse', function(){