Use raises correctly.

This commit is contained in:
Brad Dunbar
2012-04-18 11:03:40 -04:00
parent 9c0814133b
commit 35bb2c0fdc

View File

@@ -125,17 +125,17 @@ $(document).ready(function() {
equal(col.at(i).get('at'), i);
}
});
test("Collection: add; at should have preference over comparator", function() {
var Col = Backbone.Collection.extend({
comparator: function(a,b) {
return a.id > b.id ? -1 : 1;
}
});
var col = new Col([{id: 2}, {id: 3}]);
col.add(new Backbone.Model({id: 1}), {at: 1});
equal(col.pluck('id').join(' '), '3 1 2');
});
@@ -519,7 +519,9 @@ $(document).ready(function() {
var col = new Collection;
col.add([{id: 1}, {id: 2}, {id: 3}, {id: 4}, {id: 5}, {id: 6}]);
}, "Can't add an invalid model to a collection");
}, function(e) {
return e.message === "Can't add an invalid model to a collection";
});
});
test("Collection: index with comparator", function() {