mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
adding test for falsy comparators (#1342)
This commit is contained in:
@@ -599,4 +599,17 @@ $(document).ready(function() {
|
||||
ok(!collection.get('undefined'));
|
||||
});
|
||||
|
||||
test("Collection: falsy comparator", function(){
|
||||
var Col = Backbone.Collection.extend({
|
||||
comparator: function(model){ return model.id; }
|
||||
});
|
||||
var col = new Col([{id: 2}, {id: 1}], {
|
||||
comparator: false
|
||||
});
|
||||
var otherCol = new Col([{id: 2}, {id: 1}]);
|
||||
raises(function(){ col.sort() });
|
||||
equal(col.first().id, 2);
|
||||
equal(otherCol.first().id, 1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user