Skip to content
Browse files

merge conflict resolved

  • Loading branch information...
2 parents 804bb55 + 0051734 commit 06c764c5e895442a929414178e8a5c453c816bb3 @jashkenas committed
Showing with 12 additions and 1 deletion.
  1. +1 −1 backbone.js
  2. +11 −0 test/model.js
View
2 backbone.js
@@ -372,7 +372,7 @@
}
// Do not persist invalid models.
- if (!attrs && !this.isValid()) return false;
+ if (!attrs && !this._validate(null, options)) return false;
// After a successful server-side save, the client is (optionally)
// updated with the server-side state.
View
11 test/model.js
@@ -816,6 +816,17 @@ $(document).ready(function() {
strictEqual(model.save(), false);
});
+ test("#1377 - Save without attrs triggers 'error'.", 1, function() {
+ var Model = Backbone.Model.extend({
+ url: '/test/',
+ sync: function(method, model, options){ options.success(); },
+ validate: function(){ return 'invalid'; }
+ });
+ var model = new Model({id: 1});
+ model.on('error', function(){ ok(true); });
+ model.save();
+ });
+
test("#1545 - `undefined` can be passed to a model constructor without coersion", function() {
var Model = Backbone.Model.extend({
defaults: { one: 1 },

0 comments on commit 06c764c

Please sign in to comment.
Something went wrong with that request. Please try again.