Rebuild update vendors, minified files, and adjust README.md changelog.

Former-commit-id: a01567b3d8e88da0cb20e12c864703e633b86fc6
This commit is contained in:
John-David Dalton
2012-12-03 22:40:28 -08:00
parent bb187db49d
commit ed8746df77
12 changed files with 119 additions and 91 deletions

View File

@@ -61,10 +61,10 @@ $(document).ready(function() {
test("flatten", function() {
var list = [1, [2], [3, [[[4]]]]];
equal(JSON.stringify(_.flatten(list)), '[1,2,3,4]', 'can flatten nested arrays');
equal(JSON.stringify(_.flatten(list, true)), '[1,2,3,[[[4]]]]', 'can shallowly flatten nested arrays');
deepEqual(_.flatten(list), [1,2,3,4], 'can flatten nested arrays');
deepEqual(_.flatten(list, true), [1,2,3,[[[4]]]], 'can shallowly flatten nested arrays');
var result = (function(){ return _.flatten(arguments); })(1, [2], [3, [[[4]]]]);
equal(JSON.stringify(result), '[1,2,3,4]', 'works on an arguments object');
deepEqual(result, [1,2,3,4], 'works on an arguments object');
});
test("without", function() {

View File

@@ -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++; };