Ensure bound result of _.bind(func, …) is an instance of bound and func.

Former-commit-id: d8176ad5eb45a3d675617676fc1eee4d9cbd6ebc
This commit is contained in:
John-David Dalton
2012-11-30 23:16:39 -08:00
parent 3e11d58d73
commit da9758c2f3
2 changed files with 16 additions and 8 deletions

View File

@@ -209,6 +209,14 @@
bound(['b'], 'c');
deepEqual(args, ['a', ['b'], 'c']);
});
test('ensure `new bound` is an instance of `bound` and `func`', function() {
var func = function() {},
bound = _.bind(func, {}),
instance = new bound;
ok(instance instanceof bound && instance instanceof func);
});
}());
/*--------------------------------------------------------------------------*/