mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Add _#plant test for cloned chainAll settings.
This commit is contained in:
19
test/test.js
19
test/test.js
@@ -16638,19 +16638,34 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should reset iterator data on cloned sequences', 2, function() {
|
test('should clone `chainAll` settings', 1, function() {
|
||||||
|
if (!isNpm) {
|
||||||
|
var array1 = [2, 4],
|
||||||
|
array2 = [6, 8],
|
||||||
|
wrapped1 = _(array1).chain().map(square),
|
||||||
|
wrapped2 = wrapped1.plant(array2);
|
||||||
|
|
||||||
|
deepEqual(wrapped2.first().value(), 36);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
skipTest();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
test('should reset iterator data on cloned sequences', 3, function() {
|
||||||
if (!isNpm) {
|
if (!isNpm) {
|
||||||
var array1 = [2, 4],
|
var array1 = [2, 4],
|
||||||
array2 = [6, 8],
|
array2 = [6, 8],
|
||||||
wrapped1 = _(array1).map(square);
|
wrapped1 = _(array1).map(square);
|
||||||
|
|
||||||
deepEqual(_.toArray(wrapped1), [4, 16]);
|
deepEqual(_.toArray(wrapped1), [4, 16]);
|
||||||
|
deepEqual(_.toArray(wrapped1), []);
|
||||||
|
|
||||||
var wrapped2 = wrapped1.plant(array2);
|
var wrapped2 = wrapped1.plant(array2);
|
||||||
deepEqual(_.toArray(wrapped2), [36, 64]);
|
deepEqual(_.toArray(wrapped2), [36, 64]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest(2);
|
skipTest(3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
|
|||||||
Reference in New Issue
Block a user