Skip to content
Browse files

Backbone.sync wrapper should pass the return value through from the o…

…riginal Backbone.sync.
  • Loading branch information...
1 parent fe6bd6e commit 30b328b734caf506dfa1a0111a94917e84b705d7 Erich Menge committed Mar 29, 2012
Showing with 8 additions and 1 deletion.
  1. +1 −1 backbone.localStorage.js
  2. +7 −0 tests/test.js
View
2 backbone.localStorage.js
@@ -122,7 +122,7 @@ Backbone.getSyncMethod = function(model) {
// Override 'Backbone.sync' to default to localSync,
// the original 'Backbone.sync' is still available in 'Backbone.ajaxSync'
Backbone.sync = function(method, model, options, error) {
- Backbone.getSyncMethod(model).apply(this, [method, model, options, error]);
+ return Backbone.getSyncMethod(model).apply(this, [method, model, options, error]);
};
})();
View
7 tests/test.js
@@ -158,5 +158,12 @@ $(document).ready(function() {
var method = Backbone.getSyncMethod(remoteModel);
equals(method, Backbone.ajaxSync);
});
+
+ test("Backbone.sync should return a value when ajax is used.", function ()
+ {
+ var returnValue = remoteModel.fetch({url: '/'});
+ notEqual(returnValue, undefined);
+ });
+
});

0 comments on commit 30b328b

Please sign in to comment.
Something went wrong with that request. Please try again.