mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-13 20:37:48 +00:00
Rebuild update vendors, minified files, and adjust README.md changelog.
Former-commit-id: a01567b3d8e88da0cb20e12c864703e633b86fc6
This commit is contained in:
27
vendor/underscore/test/functions.js
vendored
27
vendor/underscore/test/functions.js
vendored
@@ -37,7 +37,7 @@ $(document).ready(function() {
|
||||
var newBoundf = new Boundf();
|
||||
equal(newBoundf.hello, undefined, "function should not be bound to the context, to comply with ECMAScript 5");
|
||||
equal(Boundf().hello, "moe curly", "When called without the new operator, it's OK to be bound to the context");
|
||||
ok(newBoundf instanceof Boundf && newBoundf instanceof F, "a bound instance is an instance of the bound and original function");
|
||||
ok(newBoundf instanceof F, "a bound instance is an instance of the original function");
|
||||
});
|
||||
|
||||
test("bindAll", function() {
|
||||
@@ -165,6 +165,31 @@ $(document).ready(function() {
|
||||
}, 400);
|
||||
});
|
||||
|
||||
asyncTest("throttle triggers trailing call after repeatedly invoked", 2, function() {
|
||||
var actual;
|
||||
var counter = 0;
|
||||
var limit = 80;
|
||||
var incr = function(){ counter++; };
|
||||
var throttledIncr = _.throttle(incr, 32);
|
||||
|
||||
var stamp = new Date;
|
||||
while ((new Date - stamp) < limit) {
|
||||
throttledIncr();
|
||||
}
|
||||
_.delay(function() {
|
||||
actual = counter + 2;
|
||||
throttledIncr();
|
||||
throttledIncr();
|
||||
}, 64);
|
||||
|
||||
_.delay(function() {
|
||||
equal(counter, actual);
|
||||
start();
|
||||
}, 128);
|
||||
|
||||
ok(counter > 1);
|
||||
});
|
||||
|
||||
asyncTest("debounce", 1, function() {
|
||||
var counter = 0;
|
||||
var incr = function(){ counter++; };
|
||||
|
||||
Reference in New Issue
Block a user