Skip to content

Commit

Permalink
Use raises correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
braddunbar committed Apr 18, 2012
1 parent 9c08141 commit 35bb2c0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 35bb2c0

Please sign in to comment.