Bug 1833618: apply code formatting via Lando

# ignore-this-changeset
This commit is contained in:
Otto Länd 2023-05-23 07:50:28 +00:00
Родитель 7522041115
Коммит 3c8e3340f6
6 изменённых файлов: 312 добавлений и 325 удалений

Просмотреть файл

@ -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",

Просмотреть файл

@ -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" },
],
},
],

Просмотреть файл

@ -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" }],
},
],
},

Просмотреть файл

@ -33,40 +33,40 @@ const markup2 = `
</html>
`;
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" },
],
},
],
},
]);

Просмотреть файл

@ -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: `
<html><body>
<input id="street-address" autocomplete="street-address">
<input id="postal-code" autocomplete="postal-code">
<input id="email" autocomplete="email">
</body></html>
`,
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: `
<html><body>
<input id="postal-code" autocomplete="postal-code">
<input id="email" autocomplete="email">
@ -39,44 +38,42 @@ add_heuristic_tests(
<input id="postal-code" autocomplete="postal-code">
</body></html>
`,
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: `
<html><body>
<input id="postal-code" autocomplete="postal-code">
<input id="email" autocomplete="email">
<input id="email" autocomplete="email">
</body></html>
`,
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" },
],
},
],
},
]);

Просмотреть файл

@ -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: `
<html><body>
<input id="street-address" autocomplete="billing street-address">
<input id="postal-code" autocomplete="billing postal-code">
<input id="country" autocomplete="billing country">
</body></html>
`,
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: `
<html><body>
<input id="street-address" autocomplete="billing street-address">
<input id="postal-code" autocomplete="billing postal-code">
@ -49,34 +48,34 @@ add_heuristic_tests(
<input id="country" autocomplete="shipping country">
</body></html>
`,
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: `
<html><body>
<input id="street-address" autocomplete="billing street-address">
<input id="postal-code" autocomplete="billing postal-code">
@ -86,34 +85,34 @@ add_heuristic_tests(
<input id="country" autocomplete="billing country">
</body></html>
`,
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: `
<html><body>
<input id="street-address" autocomplete="street-address">
<input id="postal-code" autocomplete="postal-code">
@ -123,33 +122,33 @@ add_heuristic_tests(
<input id="country" autocomplete="billing country">
</body></html>
`,
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: `
<html><body>
<input id="street-address" autocomplete="billing street-address">
<input id="postal-code" autocomplete="billing postal-code">
@ -159,33 +158,33 @@ add_heuristic_tests(
<input id="country" autocomplete="country">
</body></html>
`,
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: `
<html><body>
<input id="name" autocomplete="name">
<input id="street-address" autocomplete="billing street-address">
@ -197,36 +196,36 @@ add_heuristic_tests(
<input id="name" autocomplete="name">
</body></html>
`,
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: `
<html><body>
<input id="name" autocomplete="name">
<input id="street-address" autocomplete="billing street-address">
@ -235,30 +234,28 @@ add_heuristic_tests(
<input id="name" autocomplete="name">
</body></html>
`,
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: `
<html><body>
<input id="street-address" autocomplete="billing street-address">
<input id="postal-code" autocomplete="billing postal-code">
@ -267,25 +264,25 @@ add_heuristic_tests(
<input id="email" autocomplete="email">
</body></html>
`,
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: `
<html><body>
<input id="street-address" autocomplete="street-address">
<input id="postal-code" autocomplete="postal-code">
@ -295,28 +292,27 @@ add_heuristic_tests(
<input id="country" autocomplete="country">
</body></html>
`,
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" },
],
},
],
},
]);