mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 23:57:49 +00:00
Add failing test case for current _.debounce patch.
This commit is contained in:
28
test/test.js
28
test/test.js
@@ -1530,6 +1530,34 @@
|
||||
QUnit.start();
|
||||
}
|
||||
});
|
||||
|
||||
asyncTest('should call `trailing` with the correct `arguments` and `this` binding', 1, function() {
|
||||
if (!(isRhino && isModularize)) {
|
||||
var args,
|
||||
count = 0,
|
||||
object = {};
|
||||
|
||||
var debounced = _.debounce(function(value) {
|
||||
args = [this];
|
||||
push.apply(args, arguments);
|
||||
return ++count != 2;
|
||||
}, 32, { 'leading': true, 'maxWait': 64 });
|
||||
|
||||
while (true) {
|
||||
if (!debounced.call(object, 'a')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
setTimeout(function() {
|
||||
deepEqual(args, [object, 'a']);
|
||||
QUnit.start();
|
||||
}, 256);
|
||||
}
|
||||
else {
|
||||
skipTest(1);
|
||||
QUnit.start();
|
||||
}
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user