Style tweaks

This commit is contained in:
Casey Foster
2013-09-19 15:53:54 -05:00
parent 3f2d5655d9
commit 98356bd85d
2 changed files with 8 additions and 8 deletions

View File

@@ -725,8 +725,8 @@
splice.apply(this.models, [at, 0].concat(toAdd));
} else {
if (order) this.models.length = 0;
var models = order || toAdd;
for (var i = 0, il = models.length; i < il; i++) {
models = order || toAdd;
for (i = 0, l = models.length; i < l; i++) {
this.models.push(models[i]);
}
}

View File

@@ -909,15 +909,15 @@
strictEqual(c.length, 0);
});
test("set large collection", function() {
var chromeCrashesOn = 150000; // ff crashes on 500000
var collection = new Backbone.Collection;
test("set with many models does not overflow the stack", function() {
var n = 150000;
var collection = new Backbone.Collection();
var models = [];
for (var i = 0, il = chromeCrashesOn; i < il; i++) {
models.push(new Backbone.Model({id: i}));
for (var i = 0; i < n; i++) {
models.push({id: i});
}
collection.set(models);
equal(collection.length, chromeCrashesOn);
equal(collection.length, n);
});
test("set with only cids", 3, function() {