Update vendor/underscore to 1.5.2.

This commit is contained in:
John-David Dalton
2013-09-07 14:38:53 -05:00
parent e078f584eb
commit eeabb47fb6
7 changed files with 143 additions and 76 deletions

View File

@@ -159,14 +159,14 @@ $(document).ready(function() {
asyncTest("throttle repeatedly with results", 6, function() {
var counter = 0;
var incr = function(){ return ++counter; };
var throttledIncr = _.throttle(incr, 64);
var throttledIncr = _.throttle(incr, 100);
var results = [];
var saveResult = function() { results.push(throttledIncr()); };
saveResult(); saveResult();
_.delay(saveResult, 32);
_.delay(saveResult, 80);
_.delay(saveResult, 96);
_.delay(saveResult, 144);
_.delay(saveResult, 50);
_.delay(saveResult, 150);
_.delay(saveResult, 160);
_.delay(saveResult, 230);
_.delay(function() {
equal(results[0], 1, "incr was called once");
equal(results[1], 1, "incr was throttled");
@@ -175,7 +175,7 @@ $(document).ready(function() {
equal(results[4], 2, "incr was throttled");
equal(results[5], 3, "incr was called trailing");
start();
}, 192);
}, 300);
});
asyncTest("throttle triggers trailing call when invoked repeatedly", 2, function() {
@@ -239,10 +239,10 @@ $(document).ready(function() {
var time = new Date;
while (new Date - time < 350) throttledIncr();
ok(counter === 3);
ok(counter <= 3);
_.delay(function() {
equal(counter, 4);
ok(counter <= 4);
start();
}, 200);
});