consistently handle undefined being passed to the model constr (#1545)

This commit is contained in:
Sam Breed
2012-08-14 14:16:04 -06:00
parent 5720e54355
commit b347f9f8d4
2 changed files with 14 additions and 3 deletions

View File

@@ -816,4 +816,15 @@ $(document).ready(function() {
strictEqual(model.save(), false);
});
test("#1545 - `undefined` can be passed to a model constructor without coersion", function() {
var Model = Backbone.Model.extend({
defaults: { one: 1 },
initialize : function(attrs, opts) {
equal(attrs, undefined);
}
});
var emptyattrs = new Model();
var undefinedattrs = new Model(undefined);
});
});