mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
Use raises correctly.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user