mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 23:37:49 +00:00
Add _.bindAll unit test for passing just object.
Former-commit-id: 62f90c1dc7429610fb4bfaec3c5bb64d5a63dc9e
This commit is contained in:
19
test/test.js
19
test/test.js
@@ -279,6 +279,25 @@
|
||||
QUnit.module('lodash.bindAll');
|
||||
|
||||
(function() {
|
||||
test('should bind all methods of `object`', function() {
|
||||
function Foo() {
|
||||
this._a = 1;
|
||||
this._b = 2;
|
||||
this.a = function() { return this._a; };
|
||||
};
|
||||
|
||||
Foo.prototype.b = function() {return this._b; };
|
||||
|
||||
var object = new Foo;
|
||||
_.bindAll(object);
|
||||
|
||||
var actual = _.map(_.functions(object), function(methodName) {
|
||||
return object[methodName].call({});
|
||||
});
|
||||
|
||||
deepEqual(actual, [1, 2]);
|
||||
});
|
||||
|
||||
test('should accept arrays of method names', function() {
|
||||
var object = {
|
||||
'_a': 1,
|
||||
|
||||
Reference in New Issue
Block a user