Skip to content

Collection#parse called with RelationalModel as the response argument after Collection#create with wait: true #555

@wojcikstefan

Description

@wojcikstefan

This test passes:

        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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions