mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
Added failing test case
This commit is contained in:
committed by
Justin Ridgewell
parent
c95d9775e7
commit
ffa4fa597d
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user