mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Ensure _.merge produces dense arrays and revert accepting arrays of arguments for _.compose, _.defaults, _.extend, and _.merge.
Former-commit-id: a02772f8be04e187cbbfeb324cd4fb4318098162
This commit is contained in:
37
test/test.js
37
test/test.js
@@ -395,23 +395,6 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.compose');
|
||||
|
||||
(function() {
|
||||
test('should accept arrays of functions', function() {
|
||||
var composed = _.compose([
|
||||
function(c) { return c + 'd'; },
|
||||
function(b) { return b + 'c'; }
|
||||
], [
|
||||
function(a) { return a + 'b'; }
|
||||
]);
|
||||
|
||||
equal(composed('a'), 'abcd');
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.contains');
|
||||
|
||||
(function() {
|
||||
@@ -548,11 +531,6 @@
|
||||
Foo.prototype = { 'a': 1 };
|
||||
deepEqual(func({}, new Foo), {});
|
||||
});
|
||||
|
||||
test('lodash.' + methodName + ' should accept arrays of source objects', function() {
|
||||
var actual = func({}, [{ 'a': 1 }, { 'b': 2 }], [{ 'c': 3 }]);
|
||||
deepEqual(actual, { 'a': 1, 'b': 2, 'c': 3 });
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -1406,9 +1384,24 @@
|
||||
});
|
||||
|
||||
test('should not assign `undefined` values', function() {
|
||||
var a
|
||||
var actual = _.merge({ 'a': 1 }, { 'a': undefined });
|
||||
strictEqual(actual.a, 1);
|
||||
});
|
||||
|
||||
test('should treat sparse arrays as dense', function() {
|
||||
var array = Array(3);
|
||||
array[0] = 1;
|
||||
array[2] = 3;
|
||||
|
||||
var actual = _.merge([], array),
|
||||
expected = array.slice();
|
||||
|
||||
expected[1] = undefined;
|
||||
|
||||
ok(1 in actual);
|
||||
deepEqual(actual, expected);
|
||||
});
|
||||
}(1, 2, 3));
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user