mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
Merge pull request #1342 from caseywebdev/master
Allow Collection to receive falsy `comparator` to override default
This commit is contained in:
@@ -606,4 +606,18 @@ $(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
|
||||
var colFalse = new Col(null, {comparator: false});
|
||||
var colNull = new Col(null, {comparator: null});
|
||||
var colUndefined = new Col(null, {comparator: undefined});
|
||||
ok(col.comparator);
|
||||
ok(!colFalse.comparator);
|
||||
ok(!colNull.comparator);
|
||||
ok(colUndefined.comparator);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user