Added failing test case

This commit is contained in:
Andrey Kuzmin
2015-05-26 22:58:02 +02:00
committed by Justin Ridgewell
parent c95d9775e7
commit ffa4fa597d

View File

@@ -561,6 +561,34 @@
});
test("create with wait:true should not call collection.parse", 1, function() {
var collectionParseCalled = false;
var Model = Backbone.Model.extend({
sync: function (method, model, options) {
_.extend(options, {specialSync: true});
return Backbone.Model.prototype.sync.call(this, method, model, options);
}
});
var Collection = Backbone.Collection.extend({
model: Model,
url: '/test',
parse: function () {
collectionParseCalled = true;
}
});
var collection = new Collection;
var success = function (model, response, options) {
equal(collectionParseCalled, false);
};
collection.create({}, {wait: true, success: success});
this.ajaxSettings.success();
});
test("a failing create returns model with errors", function() {
var ValidatingModel = Backbone.Model.extend({
validate: function(attrs) {