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

Feature/fix country selection from prepopulated info #2013

Conversation

minhazur-piash
Copy link
Contributor

Summary

Add an Address page's country list wasn't showing prepopulated selectedCountry. The fix was just placing shippingInfoWidget.populateShippingInfo(shippingInformation) at the last of fun bind() method of PaymentFlowPagerAdapter class as calling setAllowedCountryCodes() refreshes selected country with first item.

Motivation

To fix this open issue #2010

Testing

I have written the following test.

  @Test
    fun getSelectedShippingCountry_whenShippingInfoProvided_returnsExpected() {
        shippingInfoWidget.setAllowedCountryCodes(setOf("US", "CA"))
        shippingInfoWidget.populateShippingInfo(SHIPPING_INFO_CA)
        assertEquals(stateEditText.text.toString(), "Ontario")
        assertEquals(cityEditText.text.toString(), "Ontario")
        assertEquals(addressLine1EditText.text.toString(), "185 Berry St")
        assertEquals(addressLine2EditText.text.toString(), "10th Floor")
        assertEquals(phoneEditText.text.toString(), "416-759-0260")
        assertEquals(postalEditText.text.toString(), "M4B1B5")
        assertEquals(nameEditText.text.toString(), "Fake Name")
        assertEquals(countryAutoCompleteTextView.selectedCountry?.code, "CA")
    }

@mshafrir-stripe
Copy link
Collaborator

@minhazur-piash thanks for posting this PR!

@minhazur-piash minhazur-piash force-pushed the feature/fix_country_selection_from_prepopulated_info branch from 59131ba to 60b4677 Compare January 2, 2020 16:38
@minhazur-piash
Copy link
Contributor Author

Thanks for approving the PR. Please, let me know how I can merge now.

@mshafrir-stripe mshafrir-stripe merged commit ee7a10c into stripe:master Jan 2, 2020
@mshafrir-stripe
Copy link
Collaborator

@minhazur-piash I just merged it, thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants