Browse files

Fix #1179 - isValid returns true in the absence of validate.

  • Loading branch information...
1 parent a2ed079 commit 137b7fd670ae25141c6f5865797a0902476add6f @braddunbar braddunbar committed Apr 4, 2012
Showing with 7 additions and 1 deletion.
  1. +1 −1 backbone.js
  2. +6 −0 test/model.js
View
2 backbone.js
@@ -529,7 +529,7 @@
// Check if the model is currently in a valid state. It's only possible to
// get into an *invalid* state if you're using silent changes.
isValid: function() {
- return !this.validate(this.attributes);
+ return !this.validate || !this.validate(this.attributes);
},
// Run validation against the next complete set of model attributes,
View
6 test/model.js
@@ -784,4 +784,10 @@ $(document).ready(function() {
}
});
+ test("#1179 - isValid returns true in the absence of validate.", function() {
+ var model = new Backbone.Model();
+ model.validate = null;
+ ok(model.isValid());
+ });
+
});

0 comments on commit 137b7fd

Please sign in to comment.