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);
});
and I doubt it's the expected behavior given that w/o wait: true the same test fails. Collection#parse is also never called if you use the original backbone model instead of the RelationalModel.
This test passes:
and I doubt it's the expected behavior given that w/o
wait: true
the same test fails.Collection#parse
is also never called if you use the original backbone model instead of theRelationalModel
.