Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wojcikstefan opened this issue Nov 9, 2015 · 2 comments
Labels

Comments

@wojcikstefan
Copy link

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.

@wojcikstefan
Copy link
Author

@PaulUithol could you confirm if that's the expected behavior?

@wojcikstefan
Copy link
Author

Bump - just following up here :)

@bpatram bpatram added the bug label Mar 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants