mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Add Stack test.
This commit is contained in:
19
test/test.js
19
test/test.js
@@ -2103,6 +2103,25 @@
|
|||||||
assert.notStrictEqual(actual, cyclical['v' + (LARGE_ARRAY_SIZE - 1)]);
|
assert.notStrictEqual(actual, cyclical['v' + (LARGE_ARRAY_SIZE - 1)]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('`_.cloneDeepWith` should provide `stack` to `customizer`', function(assert) {
|
||||||
|
assert.expect(5);
|
||||||
|
|
||||||
|
var stack,
|
||||||
|
object = new Foo;
|
||||||
|
|
||||||
|
var clone = _.cloneDeepWith(object, function() {
|
||||||
|
if (arguments.length > 1) {
|
||||||
|
stack || (stack = _.last(arguments));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.strictEqual(stack.has(object), true);
|
||||||
|
assert.strictEqual(stack.get(object), clone);
|
||||||
|
assert.strictEqual(stack['delete'](object), true);
|
||||||
|
assert.strictEqual(stack.has(object), false);
|
||||||
|
assert.strictEqual(stack['delete'](object), false);
|
||||||
|
});
|
||||||
|
|
||||||
_.each(['clone', 'cloneDeep'], function(methodName) {
|
_.each(['clone', 'cloneDeep'], function(methodName) {
|
||||||
var func = _[methodName],
|
var func = _[methodName],
|
||||||
isDeep = methodName == 'cloneDeep';
|
isDeep = methodName == 'cloneDeep';
|
||||||
|
|||||||
Reference in New Issue
Block a user