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

V2.11 - Fix non auto populated customer info #4247

Conversation

nbelzer
Copy link
Contributor

@nbelzer nbelzer commented Jan 19, 2022

Resolves #3966

Description

The spec tests verify the behavior of the Address Backbone View based on two fixtures, these are extracts from the partial spree/admin/shared/address_form as I was unable to render the partial itself (due to the country and state fields). Because of this, the fixtures do not render the country and state fields, nor does the spec test verify that they are updated. Since this is unrelated to the original issue I don't think this is a problem for this PR.

It looks like this issue also exists on Solidus v3.x, so perhaps we should also merge these changes into the master branch? I would need some advice on how to do this correctly.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

We do not need to choose between using `name` or the combination of
`firstname` and `lastname` as the statement `if (el.length)` will filter
out any fields that are not rendered (which depends on the
`use_combined_first_and_last_name_in_address` preference).
Implements two spec tests that simulate both states for the preference
`use_combined_first_and_last_name_in_address` verifying that the name
fields are updated correctly.

The fixtures are simplified versions of the partial
'spree/admin/shared/address_form' as I was unable to use the partial
rendering.  This means that the tests only verify that the
Spree.Views.Order.Address Backbone View correctly tries to update the
fields.
@kennyadsl
Copy link
Member

kennyadsl commented Jan 19, 2022

@nbelzer thanks for this!!

3.x shouldn't have the use_combined_first_and_last_name_in_address preference. The default behavior from 3.0 is the same as having it true, but I didn't verify that this feature is working correctly on those versions. If you can check it would be awesome.

@nbelzer
Copy link
Contributor Author

nbelzer commented Jan 19, 2022

@kennyadsl You are correct, the preference does not exist on Spree::AppConfiguration (on Solidus 3.x) and the issue also doesn't appear as the field shown is Name which was already included in the Address Backbone view:

eachField: function(callback){
var view = this;
var fields = ["name", "company", "address1", "address2",
"city", "zipcode", "phone", "country_id", "state_name"];
_.each(fields, function(field) {
var el = view.$('[name$="[' + field + ']"]');
if (el.length) callback(field, el);
});
},

@nbelzer nbelzer changed the title Fix non auto populated customer info V2.11 Fix non auto populated customer info Jan 19, 2022
@nbelzer nbelzer changed the title V2.11 Fix non auto populated customer info V2.11 - Fix non auto populated customer info Jan 19, 2022
Copy link
Member

@kennyadsl kennyadsl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nbelzer!

Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nbelzer thank you!

@spaghetticode spaghetticode merged commit 213ad1d into solidusio:v2.11 Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants