test( "Prove that Collection#parse is called with a RelationalModel as the response", function() {
var parseArg;
var Contact = Backbone.RelationalModel.extend();
var Contacts = Backbone.Collection.extend({
model: Contact,
url: '/contacts',
parse: function( response ) {
parseArg = response;
return response.items;
}
});
var contacts = new Contacts();
contacts.create({ foo: 3 }, {
wait: true,
// fake response for testing
response: {
status: 200,
responseText: { foo: 3 }
}
});
equal(parseArg instanceof Backbone.RelationalModel, true);
});
This test passes:
and I doubt it's the expected behavior given that w/o
wait: truethe same test fails.Collection#parseis also never called if you use the original backbone model instead of theRelationalModel.