diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js b/browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js index b85e01bb2207..8eb774b65c37 100644 --- a/browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_cc_exp.js @@ -24,10 +24,7 @@ add_heuristic_tests( default: { reason: "autocomplete", }, - fields: [ - { fieldName: "cc-number" }, - { fieldName: "cc-exp" }, - ], + fields: [{ fieldName: "cc-number" }, { fieldName: "cc-exp" }], }, { description: "form3", diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js index ffc037d545c1..0d47cb6935e8 100644 --- a/browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_de_fields.js @@ -9,20 +9,20 @@ add_heuristic_tests( expectedResult: [ { fields: [ - { fieldName: "cc-name", reason: "fathom" }, - { fieldName: "cc-type", reason: "regex-heuristic" }, - { fieldName: "cc-number", reason: "fathom" }, + { fieldName: "cc-name", reason: "fathom" }, + { fieldName: "cc-type", reason: "regex-heuristic" }, + { fieldName: "cc-number", reason: "fathom" }, { fieldName: "cc-exp-month", reason: "regex-heuristic" }, - { fieldName: "cc-exp-year", reason: "regex-heuristic" }, + { fieldName: "cc-exp-year", reason: "regex-heuristic" }, ], }, { fields: [ - { fieldName: "cc-name", reason: "fathom" }, - { fieldName: "cc-type", reason: "regex-heuristic" }, - { fieldName: "cc-number", reason: "fathom" }, + { fieldName: "cc-name", reason: "fathom" }, + { fieldName: "cc-type", reason: "regex-heuristic" }, + { fieldName: "cc-number", reason: "fathom" }, { fieldName: "cc-exp-month", reason: "regex-heuristic" }, - { fieldName: "cc-exp-year", reason: "regex-heuristic" }, + { fieldName: "cc-exp-year", reason: "regex-heuristic" }, ], }, ], diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js b/browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js index a0754f519029..078f2240db93 100644 --- a/browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_multiple_section.js @@ -13,8 +13,8 @@ add_heuristic_tests( addressType: "shipping", }, fields: [ - { fieldName: "name", addressType: ""}, - { fieldName: "organization", addressType: ""}, + { fieldName: "name", addressType: "" }, + { fieldName: "organization", addressType: "" }, { fieldName: "street-address" }, { fieldName: "address-level2" }, { fieldName: "address-level1" }, @@ -59,8 +59,8 @@ add_heuristic_tests( // Even the `contactType` of these two fields are different with the // above two, we still consider they are identical until supporting // multiple phone number and email in one profile. - {"fieldName": "tel", "contactType": "home"}, - {"fieldName": "email", "contactType": "home"}, + { fieldName: "tel", contactType: "home" }, + { fieldName: "email", contactType: "home" }, ], }, { @@ -109,10 +109,7 @@ add_heuristic_tests( reason: "autocomplete", contactType: "home", }, - fields: [ - { fieldName: "tel" }, - { fieldName: "email" }, - ], + fields: [{ fieldName: "tel" }, { fieldName: "email" }], }, ], }, diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_parseAddressFields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_parseAddressFields.js index 45151b5c7f46..717e40faf647 100644 --- a/browser/extensions/formautofill/test/browser/heuristics/browser_parseAddressFields.js +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_parseAddressFields.js @@ -33,40 +33,40 @@ const markup2 = ` `; -add_heuristic_tests( - [ - { - fixtureData: markup1, - expectedResult: [ - { - description: "Address Line1 in the last element and is not updated in _parsedAddressFields", - default: { - reason: "regex-heuristic", - }, - fields: [ - { fieldName: "country" }, - { fieldName: "tel" }, - { fieldName: "address-line1" }, - ], +add_heuristic_tests([ + { + fixtureData: markup1, + expectedResult: [ + { + description: + "Address Line1 in the last element and is not updated in _parsedAddressFields", + default: { + reason: "regex-heuristic", }, - ], - }, - { - fixtureData: markup2, - expectedResult: [ - { - description: "Address Line2 in the last element and is not updated in _parsedAddressFields", - default: { - reason: "regex-heuristic", - }, - fields: [ - { fieldName: "country" }, - { fieldName: "tel" }, - { fieldName: "address-line1" }, - { fieldName: "address-line2" }, - ], + fields: [ + { fieldName: "country" }, + { fieldName: "tel" }, + { fieldName: "address-line1" }, + ], + }, + ], + }, + { + fixtureData: markup2, + expectedResult: [ + { + description: + "Address Line2 in the last element and is not updated in _parsedAddressFields", + default: { + reason: "regex-heuristic", }, - ], - }, - ] -); + fields: [ + { fieldName: "country" }, + { fieldName: "tel" }, + { fieldName: "address-line1" }, + { fieldName: "address-line2" }, + ], + }, + ], + }, +]); diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js b/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js index f6df796dee46..2e9cf42ab0b4 100644 --- a/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js @@ -5,33 +5,32 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ "use strict"; -add_heuristic_tests( - [ - { - description: `An address section is valid when it only contains more than three fields`, - fixtureData: ` +add_heuristic_tests([ + { + description: `An address section is valid when it only contains more than three fields`, + fixtureData: ` `, - expectedResult: [ - { - default: { - reason: "autocomplete", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "email" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", }, - ], - }, - { - description: `An address section is invalid when it contains less than threee fields`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "email" }, + ], + }, + ], + }, + { + description: `An address section is invalid when it contains less than threee fields`, + fixtureData: ` @@ -39,44 +38,42 @@ add_heuristic_tests( `, - expectedResult: [ - { - description: "A section with two fields", - invalid: true, - fields: [ - { fieldName: "postal-code", reason: "autocomplete" }, - { fieldName: "email", reason: "autocomplete" }, - ], - }, - { - description: "A section with one field", - invalid: true, - fields: [ - { fieldName: "postal-code", reason: "autocomplete" }, - ], - }, - ], - }, - { - description: `Address section validation only counts the number of different address field name in the section`, - fixtureData: ` + expectedResult: [ + { + description: "A section with two fields", + invalid: true, + fields: [ + { fieldName: "postal-code", reason: "autocomplete" }, + { fieldName: "email", reason: "autocomplete" }, + ], + }, + { + description: "A section with one field", + invalid: true, + fields: [{ fieldName: "postal-code", reason: "autocomplete" }], + }, + ], + }, + { + description: `Address section validation only counts the number of different address field name in the section`, + fixtureData: ` `, - expectedResult: [ - { - description: "A section with three fields but has duplicated email fields", - invalid: true, - fields: [ - { fieldName: "postal-code", reason: "autocomplete" }, - { fieldName: "email", reason: "autocomplete" }, - { fieldName: "email", reason: "autocomplete" }, - ], - }, - ], - }, - ] -); + expectedResult: [ + { + description: + "A section with three fields but has duplicated email fields", + invalid: true, + fields: [ + { fieldName: "postal-code", reason: "autocomplete" }, + { fieldName: "email", reason: "autocomplete" }, + { fieldName: "email", reason: "autocomplete" }, + ], + }, + ], + }, +]); diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js index 33393932c1ee..c6c8ea5759de 100644 --- a/browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_by_name.js @@ -12,34 +12,33 @@ http://creativecommons.org/publicdomain/zero/1.0/ */ // - Fields without section name are merged to a section with section name // - Two sections without name -add_heuristic_tests( - [ - { - description: `One named billing section`, - fixtureData: ` +add_heuristic_tests([ + { + description: `One named billing section`, + fixtureData: ` `, - expectedResult: [ - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", + addressType: "billing", }, - ], - }, - { - description: `One billing section and one shipping section`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + ], + }, + { + description: `One billing section and one shipping section`, + fixtureData: ` @@ -49,34 +48,34 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", + addressType: "billing", }, - { - default: { - reason: "autocomplete", - addressType: "shipping", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + { + default: { + reason: "autocomplete", + addressType: "shipping", }, - ], - }, - { - description: `One billing section, one shipping section, and then billing section`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + ], + }, + { + description: `One billing section, one shipping section, and then billing section`, + fixtureData: ` @@ -86,34 +85,34 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", + addressType: "billing", }, - { - default: { - reason: "autocomplete", - addressType: "shipping", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + { + default: { + reason: "autocomplete", + addressType: "shipping", }, - ], - }, - { - description: `one section without a name and one billing section`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + ], + }, + { + description: `one section without a name and one billing section`, + fixtureData: ` @@ -123,33 +122,33 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", }, - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + { + default: { + reason: "autocomplete", + addressType: "billing", }, - ], - }, - { - description: `One billing section and one section without a name`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + ], + }, + { + description: `One billing section and one section without a name`, + fixtureData: ` @@ -159,33 +158,33 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", + addressType: "billing", }, - { - default: { - reason: "autocomplete", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + { + default: { + reason: "autocomplete", }, - ], - }, - { - description: `Fields without section name are merged (test both before and after the section with a name)`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + ], + }, + { + description: `Fields without section name are merged (test both before and after the section with a name)`, + fixtureData: ` @@ -197,36 +196,36 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "name", addressType: "" }, - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", + addressType: "billing", }, - { - default: { - reason: "autocomplete", - addressType: "shipping", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - { fieldName: "name", addressType: "" }, - ], + fields: [ + { fieldName: "name", addressType: "" }, + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + { + default: { + reason: "autocomplete", + addressType: "shipping", }, - ], - }, - { - description: `Fields without section name are merged, but do not merge if the field already exists`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + { fieldName: "name", addressType: "" }, + ], + }, + ], + }, + { + description: `Fields without section name are merged, but do not merge if the field already exists`, + fixtureData: ` @@ -235,30 +234,28 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "name", addressType: "" }, - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", + addressType: "billing", }, - { - invalid: true, - fields: [ - { fieldName: "name", reason: "autocomplete" }, - ], - }, - ], - }, - { - description: `Fields without section name are merged (multi-fields)`, - fixtureData: ` + fields: [ + { fieldName: "name", addressType: "" }, + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + { + invalid: true, + fields: [{ fieldName: "name", reason: "autocomplete" }], + }, + ], + }, + { + description: `Fields without section name are merged (multi-fields)`, + fixtureData: ` @@ -267,25 +264,25 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - addressType: "billing", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - { fieldName: "email", addressType: "" }, - { fieldName: "email", addressType: "" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", + addressType: "billing", }, - ], - }, - { - description: `Two sections without name`, - fixtureData: ` + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + { fieldName: "email", addressType: "" }, + { fieldName: "email", addressType: "" }, + ], + }, + ], + }, + { + description: `Two sections without name`, + fixtureData: ` @@ -295,28 +292,27 @@ add_heuristic_tests( `, - expectedResult: [ - { - default: { - reason: "autocomplete", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + expectedResult: [ + { + default: { + reason: "autocomplete", }, - { - default: { - reason: "autocomplete", - }, - fields: [ - { fieldName: "street-address" }, - { fieldName: "postal-code" }, - { fieldName: "country" }, - ], + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + { + default: { + reason: "autocomplete", }, - ], - }, - ] -); + fields: [ + { fieldName: "street-address" }, + { fieldName: "postal-code" }, + { fieldName: "country" }, + ], + }, + ], + }, +]);