Reputation: 11
I have a backbone model
var MyModel= Backbone.Model.extend({
validation: function ()
var validate= {
name: {
required: true,
},
};
return validate;
},
});
I use sinon, mocha and chai for test. When I call model.validate()
in the test it tells me that the function does not exist, how can I check that the validation works?
Upvotes: 1
Views: 45
Reputation: 43156
It seems you should do the following for validation plugin to work:
_.extend(Backbone.Model.prototype, Backbone.Validation.mixin);
Upvotes: 1