mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37:49 +00:00
Add _.forEach thisArg unit test to test.js.
Former-commit-id: b3d16d90789e76df778ac3457f68fdcbc3f6f4ad
This commit is contained in:
14
test/test.js
14
test/test.js
@@ -865,6 +865,20 @@
|
||||
equal(wrapper.forEach(Boolean), wrapper);
|
||||
});
|
||||
|
||||
test('supports the `thisArg` argument', function() {
|
||||
var actual;
|
||||
|
||||
function callback(value, index) {
|
||||
actual = this[index];
|
||||
}
|
||||
|
||||
_.forEach([1], callback, [2]);
|
||||
equal(actual, 2);
|
||||
|
||||
_.forEach({ 'a': 1 }, callback, { 'a': 2 });
|
||||
equal(actual, 2);
|
||||
});
|
||||
|
||||
_.each({
|
||||
'literal': 'abc',
|
||||
'object': Object('abc')
|
||||
|
||||
Reference in New Issue
Block a user