lodash: Make deb ounce match throttle's return value behavior. [jddalton]

Former-commit-id: 2d4073c8a2ba20b98344c19cbfaf388a2683ef19
This commit is contained in:
John-David Dalton
2012-05-01 21:13:02 -04:00
parent 367f0bd6a9
commit d5e2489cad
2 changed files with 27 additions and 10 deletions

View File

@@ -99,6 +99,19 @@
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.debounce');
(function() {
test('subsequent "immediate" debounced calls should return the result of the first call', function() {
var debounced = _.debounce(function(value) { return value; }, 100, true),
result = [debounced('x'), debounced('y')];
deepEqual(result, ['x', 'x']);
});
}());
/*--------------------------------------------------------------------------*/
QUnit.module('lodash.forEach');
(function() {