mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Add _.update.
This commit is contained in:
committed by
John-David Dalton
parent
efa1ebff16
commit
b40b555386
21
test/test.js
21
test/test.js
@@ -18439,6 +18439,25 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.update');
|
||||
|
||||
(function() {
|
||||
QUnit.test('should call `func` with existing value on `path` of `object` and update it', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var object = { 'a': [{ 'b': { 'c': 10 } }] };
|
||||
|
||||
_.update(object, ['a', 0, 'b', 'c'], function(value) {
|
||||
assert.equal(value, 10);
|
||||
return 20;
|
||||
});
|
||||
|
||||
assert.equal(object.a[0].b.c, 20);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('set methods');
|
||||
|
||||
lodashStable.each(['set', 'setWith'], function(methodName) {
|
||||
@@ -24389,7 +24408,7 @@
|
||||
var acceptFalsey = lodashStable.difference(allMethods, rejectFalsey);
|
||||
|
||||
QUnit.test('should accept falsey arguments', function(assert) {
|
||||
assert.expect(298);
|
||||
assert.expect(299);
|
||||
|
||||
var emptyArrays = lodashStable.map(falsey, alwaysEmptyArray);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user