mirror of
https://github.com/bitwarden/android.git
synced 2026-10-22 19:13:34 -05:00
Setting isAddressExtendedField check before isPostalAddressFullField so that more specific term is properly validated
This commit is contained in:
2 files changed
+20
-1
No files matched your search
@@ -187,8 +187,10 @@ private fun AssistStructure.ViewNode.supportedAutofillHint(
|
||||
this.isPersonNameGivenField -> AutofillHint.Identity.PERSON_NAME_GIVEN
|
||||
this.isPersonNameMiddleField -> AutofillHint.Identity.PERSON_NAME_MIDDLE
|
||||
this.isPersonNameFamilyField -> AutofillHint.Identity.PERSON_NAME_FAMILY
|
||||
this.isPostalAddressFullField -> AutofillHint.Identity.POSTAL_ADDRESS_FULL
|
||||
// Must be checked before isPostalAddressFullField: a line-2 name like "billing_address_2"
|
||||
// also substring-matches the postal-full terms, so the more specific check has to win.
|
||||
this.isAddressExtendedField -> AutofillHint.Identity.ADDRESS_EXTENDED
|
||||
this.isPostalAddressFullField -> AutofillHint.Identity.POSTAL_ADDRESS_FULL
|
||||
this.isAddressStreetField -> AutofillHint.Identity.ADDRESS_STREET
|
||||
this.isAddressLocalityField -> AutofillHint.Identity.ADDRESS_LOCALITY
|
||||
this.isAddressRegionField -> AutofillHint.Identity.ADDRESS_REGION
|
||||
|
||||
@@ -1667,6 +1667,23 @@ class ViewNodeExtensionsTest {
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `toAutofillView should return AutofillView Identity AddressExtended when idEntry is billing_address_2`() {
|
||||
setupUnsupportedInputFieldViewNode()
|
||||
every { viewNode.idEntry } returns "billing_address_2"
|
||||
|
||||
val resolvedView = viewNode.toAutofillView(
|
||||
parentWebsite = null,
|
||||
isIdentityAutofillEnabled = true,
|
||||
)
|
||||
|
||||
assertEquals(
|
||||
AutofillView.Identity.AddressExtended(data = autofillViewData),
|
||||
resolvedView,
|
||||
)
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `toAutofillView should return AutofillView Identity AddressLocality when autofillHints match`() {
|
||||
|
||||
Reference in new issue
Block a user