mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Make callback behavior consistent for _.clone, _.cloneDeep, _.isEqual, and _.merge and add more doc examples.
Former-commit-id: 7a53ea18e4512dfcab5649c937db0f90d7649373
This commit is contained in:
18
test/test.js
18
test/test.js
@@ -438,6 +438,11 @@
|
||||
|
||||
equal(actual, 'A');
|
||||
});
|
||||
|
||||
test('_.' + methodName + ' should handle cloning if `callback` returns `undefined`', function() {
|
||||
var actual = _.clone({ 'a': { 'b': 'c' } }, function() { });
|
||||
deepEqual(actual, { 'a': { 'b': 'c' } });
|
||||
});
|
||||
});
|
||||
}(1, 2, 3));
|
||||
|
||||
@@ -1070,8 +1075,7 @@
|
||||
if (_._object) {
|
||||
var object = { 'a': 1, 'b': 2, 'c': 3 };
|
||||
strictEqual(_.isEqual(object, _._object), true);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
skipTest();
|
||||
}
|
||||
});
|
||||
@@ -1106,6 +1110,11 @@
|
||||
|
||||
strictEqual(actual, true);
|
||||
});
|
||||
|
||||
test('should handle comparisons if `callback` returns `undefined`', function() {
|
||||
var actual = _.isEqual('a', 'a', function() { });
|
||||
strictEqual(actual, true);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
@@ -1532,6 +1541,11 @@
|
||||
|
||||
deepEqual(actual, { 'a': 2 });
|
||||
});
|
||||
|
||||
test('should handle merging if `callback` returns `undefined`', function() {
|
||||
var actual = _.merge({ 'a': 1 }, { 'a': 2 }, function() { });
|
||||
deepEqual(actual, { 'a': 2 });
|
||||
});
|
||||
}(1, 2, 3));
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user