Update vendors.

Former-commit-id: 4ffc3f5b267f8fdf1ac074f9f9ab44b0a7c4c3dd
This commit is contained in:
John-David Dalton
2013-02-10 23:51:46 -08:00
parent 9ecbcd0075
commit 465576b5cb
5 changed files with 143 additions and 79 deletions

View File

@@ -401,7 +401,7 @@ $(document).ready(function() {
if (attrs.admin) return "Can't change admin status.";
};
model.sync = function(method, model, options) {
options.success.call(this, this, {admin: true}, options);
options.success.call(this, {admin: true});
};
model.on('invalid', function(model, error) {
lastError = error;
@@ -418,6 +418,19 @@ $(document).ready(function() {
ok(_.isEqual(this.syncArgs.model, doc));
});
test("save, fetch, destroy triggers error event when an error occurs", 3, function () {
var model = new Backbone.Model();
model.on('error', function () {
ok(true);
});
model.sync = function (method, model, options) {
options.error();
};
model.save({data: 2, id: 1});
model.fetch();
model.destroy();
});
test("save with PATCH", function() {
doc.clear().set({id: 1, a: 1, b: 2, c: 3, d: 4});
doc.save();
@@ -435,7 +448,7 @@ $(document).ready(function() {
test("save in positional style", 1, function() {
var model = new Backbone.Model();
model.sync = function(method, model, options) {
options.success(model, {}, options);
options.success();
};
model.save('title', 'Twelfth Night');
equal(model.get('title'), 'Twelfth Night');
@@ -444,8 +457,8 @@ $(document).ready(function() {
test("save with non-object success response", 2, function () {
var model = new Backbone.Model();
model.sync = function(method, model, options) {
options.success(model, '', options);
options.success(model, null, options);
options.success('', options);
options.success(null, options);
};
model.save({testing:'empty'}, {
success: function (model) {
@@ -720,7 +733,7 @@ $(document).ready(function() {
test("#1030 - `save` with `wait` results in correct attributes if success is called during sync", 2, function() {
var model = new Backbone.Model({x: 1, y: 2});
model.sync = function(method, model, options) {
options.success(model, {}, options);
options.success();
};
model.on("change:x", function() { ok(true); });
model.save({x: 3}, {wait: true});
@@ -893,7 +906,7 @@ $(document).ready(function() {
}
};
model.sync = function(method, model, options) {
options.success(model, {}, options);
options.success();
};
model.save({id: 1}, opts);
model.fetch(opts);
@@ -902,9 +915,8 @@ $(document).ready(function() {
test("#1412 - Trigger 'sync' event.", 3, function() {
var model = new Backbone.Model({id: 1});
model.url = '/test';
model.sync = function (method, model, options) { options.success(); };
model.on('sync', function(){ ok(true); });
Backbone.ajax = function(settings){ settings.success(); };
model.fetch();
model.save();
model.destroy();
@@ -950,7 +962,7 @@ $(document).ready(function() {
var Model = Backbone.Model.extend({
sync: function(method, model, options) {
setTimeout(function(){
options.success(model, {}, options);
options.success();
start();
}, 0);
}