Add _.bindAll unit test for passing just object.

Former-commit-id: 62f90c1dc7429610fb4bfaec3c5bb64d5a63dc9e
This commit is contained in:
John-David Dalton
2013-02-04 08:36:15 -08:00
parent d58e366c40
commit a926829c33

View File

@@ -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,