mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 17:37:50 +00:00
Add _.drop, unit tests, and cleanup documentation for _.extend, _.defaults, and _.pick.
Former-commit-id: a45b0c45d52fdbe5f71984412d631f3dfe87965b
This commit is contained in:
41
test/test.js
41
test/test.js
@@ -201,6 +201,34 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.drop');
|
||||
|
||||
(function() {
|
||||
var object = { 'a': 1, 'b': 2, 'c': 3 },
|
||||
actual = { 'b': 2 };
|
||||
|
||||
test('should accept individual property names', function() {
|
||||
deepEqual(_.drop(object, 'a', 'c'), actual);
|
||||
});
|
||||
|
||||
test('should accept an array of property names', function() {
|
||||
deepEqual(_.drop(object, ['a', 'c']), actual);
|
||||
});
|
||||
|
||||
test('should accept mixes of individual and arrays of property names', function() {
|
||||
deepEqual(_.drop(object, ['a'], 'c'), actual);
|
||||
});
|
||||
|
||||
test('should iterate over inherited properties', function() {
|
||||
function Foo() {}
|
||||
Foo.prototype = object;
|
||||
|
||||
deepEqual(_.drop(new Foo, 'a', 'c'), actual);
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.escape');
|
||||
|
||||
(function() {
|
||||
@@ -642,6 +670,19 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.pick');
|
||||
|
||||
(function() {
|
||||
test('should iterate over inherited properties', function() {
|
||||
function Foo() {}
|
||||
Foo.prototype = { 'a': 1, 'b': 2, 'c': 3 };
|
||||
|
||||
deepEqual(_.pick(new Foo, 'b'), { 'b': 2 });
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.pluck');
|
||||
|
||||
(function() {
|
||||
|
||||
Reference in New Issue
Block a user