mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 03:17:49 +00:00
Add a test for _.remove and index params.
This commit is contained in:
13
test/test.js
13
test/test.js
@@ -12359,14 +12359,17 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('should provide the correct `predicate` arguments', 1, function() {
|
test('should provide the correct `predicate` arguments', 1, function() {
|
||||||
var args,
|
var argsList = [],
|
||||||
array = [1, 2, 3];
|
array = [1, 2, 3, 4];
|
||||||
|
|
||||||
_.remove(array, function() {
|
_.remove(array, function(value, index) {
|
||||||
args || (args = slice.call(arguments));
|
var args = slice.call(arguments);
|
||||||
|
args[2] = args[2].slice();
|
||||||
|
argsList.push(args);
|
||||||
|
return index % 2;
|
||||||
});
|
});
|
||||||
|
|
||||||
deepEqual(args, [1, 0, array]);
|
deepEqual(argsList, [[1, 0, [1, 2, 3, 4]], [2, 1, [1, 2, 3, 4]], [3, 1, [1, 3, 4]], [4, 1, [1, 4]]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should support the `thisArg` argument', 1, function() {
|
test('should support the `thisArg` argument', 1, function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user