From de50fc460760efa34bccb74b2c8a65005e567fd2 Mon Sep 17 00:00:00 2001 From: Aseem Kishore Date: Fri, 25 Mar 2011 12:06:10 -0700 Subject: [PATCH] Add test case for invoke w/ function reference. --- test/collections.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/collections.js b/test/collections.js index 442b205f1..69b98c2ac 100644 --- a/test/collections.js +++ b/test/collections.js @@ -154,6 +154,13 @@ $(document).ready(function() { equals(result[1].join(', '), '1, 2, 3', 'second array sorted'); }); + test('collections: invoke w/ function reference', function() { + var list = [[5, 1, 7], [3, 2, 1]]; + var result = _.invoke(list, Array.prototype.sort); + equals(result[0].join(', '), '1, 5, 7', 'first array sorted'); + equals(result[1].join(', '), '1, 2, 3', 'second array sorted'); + }); + test('collections: pluck', function() { var people = [{name : 'moe', age : 30}, {name : 'curly', age : 50}]; equals(_.pluck(people, 'name').join(', '), 'moe, curly', 'pulls names out of objects');