Bug 1933924, improvements to expresions for matching house number and apartment in portuguese, r=dimi,credential-management-reviewers
The change to browser_parse_street_address_fields.js is to ensure we are still testing the original purpose of that test. Differential Revision: https://phabricator.services.mozilla.com/D242739
This commit is contained in:
@@ -168,4 +168,111 @@ add_autofill_heuristic_tests([
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
description: "Test autofill with label for neighbourhood and house number",
|
||||
fixtureData: `<form>
|
||||
<label>Nome <input id="field1"/></label>
|
||||
<label>Endereço <input id="field2"/></label>
|
||||
<label>Número<input id="field3"/></label>
|
||||
<label>Apartamento<input id="field4"></label>
|
||||
<label>CEP <input id="field5"></label>
|
||||
<label>Estado <input id="field6"></label>
|
||||
<label>Cidade <input id="field7"></label>
|
||||
<label>Bairro <input id="field8"></label>
|
||||
</form>`,
|
||||
profile: TEST_PROFILE_BR,
|
||||
expectedResult: [
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
fieldName: "name",
|
||||
autofill:
|
||||
TEST_PROFILE_BR["given-name"] +
|
||||
" " +
|
||||
TEST_PROFILE_BR["family-name"],
|
||||
},
|
||||
{ fieldName: "address-line1", autofill: "Rua Acores" },
|
||||
{
|
||||
fieldName: "address-housenumber",
|
||||
autofill: "160",
|
||||
reason: "update-heuristic",
|
||||
},
|
||||
{ fieldName: "address-line2", autofill: "Apartment 300" },
|
||||
{
|
||||
fieldName: "postal-code",
|
||||
autofill: TEST_PROFILE_BR["postal-code"],
|
||||
},
|
||||
{
|
||||
fieldName: "address-level1",
|
||||
autofill: TEST_PROFILE_BR["address-level1"],
|
||||
},
|
||||
{
|
||||
fieldName: "address-level2",
|
||||
autofill: TEST_PROFILE_BR["address-level2"],
|
||||
},
|
||||
{
|
||||
fieldName: "address-level3",
|
||||
autofill: TEST_PROFILE_BR["address-level3"],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
description:
|
||||
"Test autofill with alternative label text (complentary and numero)",
|
||||
fixtureData: `<form>
|
||||
<label>Nome <input id="field1"/></label>
|
||||
<label>Endereço <input id="field2"/></label>
|
||||
<label>Numero<input id="field3"/></label>
|
||||
<label>Complemento<input id="field4"></label>
|
||||
<label>CEP <input id="field5"></label>
|
||||
<label>Estado <input id="field6"></label>
|
||||
<label>Cidade <input id="field7"></label>
|
||||
<label>Bairro <input id="field8"></label>
|
||||
</form>`,
|
||||
profile: TEST_PROFILE_BR,
|
||||
expectedResult: [
|
||||
{
|
||||
default: {
|
||||
reason: "regex-heuristic",
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
fieldName: "name",
|
||||
autofill:
|
||||
TEST_PROFILE_BR["given-name"] +
|
||||
" " +
|
||||
TEST_PROFILE_BR["family-name"],
|
||||
},
|
||||
{ fieldName: "address-line1", autofill: "Rua Acores" },
|
||||
{
|
||||
fieldName: "address-housenumber",
|
||||
autofill: "160",
|
||||
reason: "update-heuristic",
|
||||
},
|
||||
{ fieldName: "address-line2", autofill: "Apartment 300" },
|
||||
{
|
||||
fieldName: "postal-code",
|
||||
autofill: TEST_PROFILE_BR["postal-code"],
|
||||
},
|
||||
{
|
||||
fieldName: "address-level1",
|
||||
autofill: TEST_PROFILE_BR["address-level1"],
|
||||
},
|
||||
{
|
||||
fieldName: "address-level2",
|
||||
autofill: TEST_PROFILE_BR["address-level2"],
|
||||
},
|
||||
{
|
||||
fieldName: "address-level3",
|
||||
autofill: TEST_PROFILE_BR["address-level3"],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -153,7 +153,7 @@ add_heuristic_tests([
|
||||
<input id="first-name">
|
||||
<label for="last-name">Last Name</label>
|
||||
<input id="last-name">
|
||||
<label for="a1">Saisir une adresse numero de maison inclus</label>
|
||||
<label for="a1">Straße / nummer</label>
|
||||
<input id="a1">
|
||||
</form></body></html>`,
|
||||
expectedResult: [
|
||||
|
||||
@@ -56,7 +56,8 @@ export const HeuristicsRegExp = {
|
||||
"address-line3": "addrline3|address_3|addl3",
|
||||
"address-level2": "città", // it-IT
|
||||
"address-housenumber":
|
||||
"house\\s*number|hausnummer|haus|house[a-z\-]*n(r|o)",
|
||||
"house\\s*number|hausnummer|haus|house[a-z\-]*n(r|o)" +
|
||||
"|n[úu]mero",
|
||||
"address-level3":
|
||||
"(^address-?level-?3$)" +
|
||||
"|neighbou*rhood|barrio|bairro|colonia|suburb", // en/es/pt/mx/au/nz
|
||||
@@ -653,6 +654,7 @@ export const HeuristicsRegExp = {
|
||||
"address-line2":
|
||||
"address|line" +
|
||||
"|house|building|apartment|floor" + // de-DE
|
||||
"|apartamento|" + // pt
|
||||
"|adresse" + // fr-FR
|
||||
"|indirizzo" + // it-IT
|
||||
"|地址" + // zh-CN
|
||||
|
||||
Reference in New Issue
Block a user