lodash: Add support for "lazy" bind. [jddalton]

Former-commit-id: 472c0436f7de4e636dd878900119008bf39592fa
This commit is contained in:
John-David Dalton
2012-05-01 00:34:40 -04:00
parent 6fb7681a2d
commit 24d5fbb595
2 changed files with 57 additions and 6 deletions

View File

@@ -76,6 +76,29 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.bind');
(function() {
test('supports lazy bind', function() {
var object = {
'name': 'moe',
'greet': function(greeting) {
return greeting + ': ' + this.name;
}
};
var func = _.bind(object, 'greet', 'hi');
equal(func(), 'hi: moe');
object.greet = function(greeting) {
return greeting + ' ' + this.name + '!';
};
equal(func(), 'hi moe!');
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.forEach');
(function() {