diff --git a/payments-core/src/main/java/com/stripe/android/view/PostalCodeEditText.kt b/payments-core/src/main/java/com/stripe/android/view/PostalCodeEditText.kt index c0e20a344a3..6ebfb888b3b 100644 --- a/payments-core/src/main/java/com/stripe/android/view/PostalCodeEditText.kt +++ b/payments-core/src/main/java/com/stripe/android/view/PostalCodeEditText.kt @@ -76,6 +76,7 @@ class PostalCodeEditText @JvmOverloads constructor( updateHint(R.string.address_label_postal_code) keyListener = TextKeyListener.getInstance() inputType = InputType.TYPE_TEXT_VARIATION_POSTAL_ADDRESS + filters = arrayOf() } /** diff --git a/payments-core/src/test/java/com/stripe/android/view/PostalCodeEditTextTest.kt b/payments-core/src/test/java/com/stripe/android/view/PostalCodeEditTextTest.kt index 145966b6d95..20d8642ae10 100644 --- a/payments-core/src/test/java/com/stripe/android/view/PostalCodeEditTextTest.kt +++ b/payments-core/src/test/java/com/stripe/android/view/PostalCodeEditTextTest.kt @@ -54,6 +54,19 @@ class PostalCodeEditTextTest { .isEqualTo("12345") } + @Test + fun changing_from_Us_to_other_country_should_allow_longer_postal() { + postalCodeEditText.config = PostalCodeEditText.Config.US + postalCodeEditText.setText("123456") + assertThat(postalCodeEditText.postalCode) + .isEqualTo("12345") + + postalCodeEditText.config = PostalCodeEditText.Config.Global + postalCodeEditText.setText("123456") + assertThat(postalCodeEditText.postalCode) + .isEqualTo("123456") + } + @Test fun updateHint_whenTextInputLayoutHintEnabled_shouldSetHintOnTextInputLayout() { createActivity {