зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1833618: apply code formatting via Lando
# ignore-this-changeset
This commit is contained in:
Родитель
7522041115
Коммит
3c8e3340f6
|
@ -24,10 +24,7 @@ add_heuristic_tests(
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [{ fieldName: "cc-number" }, { fieldName: "cc-exp" }],
|
||||||
{ fieldName: "cc-number" },
|
|
||||||
{ fieldName: "cc-exp" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "form3",
|
description: "form3",
|
||||||
|
|
|
@ -9,20 +9,20 @@ add_heuristic_tests(
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
fields: [
|
fields: [
|
||||||
{ fieldName: "cc-name", reason: "fathom" },
|
{ fieldName: "cc-name", reason: "fathom" },
|
||||||
{ fieldName: "cc-type", reason: "regex-heuristic" },
|
{ fieldName: "cc-type", reason: "regex-heuristic" },
|
||||||
{ fieldName: "cc-number", reason: "fathom" },
|
{ fieldName: "cc-number", reason: "fathom" },
|
||||||
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
||||||
{ fieldName: "cc-exp-year", reason: "regex-heuristic" },
|
{ fieldName: "cc-exp-year", reason: "regex-heuristic" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
fields: [
|
fields: [
|
||||||
{ fieldName: "cc-name", reason: "fathom" },
|
{ fieldName: "cc-name", reason: "fathom" },
|
||||||
{ fieldName: "cc-type", reason: "regex-heuristic" },
|
{ fieldName: "cc-type", reason: "regex-heuristic" },
|
||||||
{ fieldName: "cc-number", reason: "fathom" },
|
{ fieldName: "cc-number", reason: "fathom" },
|
||||||
{ fieldName: "cc-exp-month", reason: "regex-heuristic" },
|
{ 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",
|
addressType: "shipping",
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
{ fieldName: "name", addressType: ""},
|
{ fieldName: "name", addressType: "" },
|
||||||
{ fieldName: "organization", addressType: ""},
|
{ fieldName: "organization", addressType: "" },
|
||||||
{ fieldName: "street-address" },
|
{ fieldName: "street-address" },
|
||||||
{ fieldName: "address-level2" },
|
{ fieldName: "address-level2" },
|
||||||
{ fieldName: "address-level1" },
|
{ fieldName: "address-level1" },
|
||||||
|
@ -59,8 +59,8 @@ add_heuristic_tests(
|
||||||
// Even the `contactType` of these two fields are different with the
|
// Even the `contactType` of these two fields are different with the
|
||||||
// above two, we still consider they are identical until supporting
|
// above two, we still consider they are identical until supporting
|
||||||
// multiple phone number and email in one profile.
|
// multiple phone number and email in one profile.
|
||||||
{"fieldName": "tel", "contactType": "home"},
|
{ fieldName: "tel", contactType: "home" },
|
||||||
{"fieldName": "email", "contactType": "home"},
|
{ fieldName: "email", contactType: "home" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -109,10 +109,7 @@ add_heuristic_tests(
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
contactType: "home",
|
contactType: "home",
|
||||||
},
|
},
|
||||||
fields: [
|
fields: [{ fieldName: "tel" }, { fieldName: "email" }],
|
||||||
{ fieldName: "tel" },
|
|
||||||
{ fieldName: "email" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
@ -33,40 +33,40 @@ const markup2 = `
|
||||||
</html>
|
</html>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
add_heuristic_tests(
|
add_heuristic_tests([
|
||||||
[
|
{
|
||||||
{
|
fixtureData: markup1,
|
||||||
fixtureData: markup1,
|
expectedResult: [
|
||||||
expectedResult: [
|
{
|
||||||
{
|
description:
|
||||||
description: "Address Line1 in the last element and is not updated in _parsedAddressFields",
|
"Address Line1 in the last element and is not updated in _parsedAddressFields",
|
||||||
default: {
|
default: {
|
||||||
reason: "regex-heuristic",
|
reason: "regex-heuristic",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "country" },
|
|
||||||
{ fieldName: "tel" },
|
|
||||||
{ fieldName: "address-line1" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "country" },
|
||||||
{
|
{ fieldName: "tel" },
|
||||||
fixtureData: markup2,
|
{ fieldName: "address-line1" },
|
||||||
expectedResult: [
|
],
|
||||||
{
|
},
|
||||||
description: "Address Line2 in the last element and is not updated in _parsedAddressFields",
|
],
|
||||||
default: {
|
},
|
||||||
reason: "regex-heuristic",
|
{
|
||||||
},
|
fixtureData: markup2,
|
||||||
fields: [
|
expectedResult: [
|
||||||
{ fieldName: "country" },
|
{
|
||||||
{ fieldName: "tel" },
|
description:
|
||||||
{ fieldName: "address-line1" },
|
"Address Line2 in the last element and is not updated in _parsedAddressFields",
|
||||||
{ fieldName: "address-line2" },
|
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";
|
"use strict";
|
||||||
|
|
||||||
add_heuristic_tests(
|
add_heuristic_tests([
|
||||||
[
|
{
|
||||||
{
|
description: `An address section is valid when it only contains more than three fields`,
|
||||||
description: `An address section is valid when it only contains more than three fields`,
|
fixtureData: `
|
||||||
fixtureData: `
|
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="street-address">
|
<input id="street-address" autocomplete="street-address">
|
||||||
<input id="postal-code" autocomplete="postal-code">
|
<input id="postal-code" autocomplete="postal-code">
|
||||||
<input id="email" autocomplete="email">
|
<input id="email" autocomplete="email">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "email" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `An address section is invalid when it contains less than threee fields`,
|
{ fieldName: "email" },
|
||||||
fixtureData: `
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `An address section is invalid when it contains less than threee fields`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="postal-code" autocomplete="postal-code">
|
<input id="postal-code" autocomplete="postal-code">
|
||||||
<input id="email" autocomplete="email">
|
<input id="email" autocomplete="email">
|
||||||
|
@ -39,44 +38,42 @@ add_heuristic_tests(
|
||||||
<input id="postal-code" autocomplete="postal-code">
|
<input id="postal-code" autocomplete="postal-code">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
description: "A section with two fields",
|
description: "A section with two fields",
|
||||||
invalid: true,
|
invalid: true,
|
||||||
fields: [
|
fields: [
|
||||||
{ fieldName: "postal-code", reason: "autocomplete" },
|
{ fieldName: "postal-code", reason: "autocomplete" },
|
||||||
{ fieldName: "email", reason: "autocomplete" },
|
{ fieldName: "email", reason: "autocomplete" },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
description: "A section with one field",
|
description: "A section with one field",
|
||||||
invalid: true,
|
invalid: true,
|
||||||
fields: [
|
fields: [{ fieldName: "postal-code", reason: "autocomplete" }],
|
||||||
{ fieldName: "postal-code", reason: "autocomplete" },
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
{
|
||||||
},
|
description: `Address section validation only counts the number of different address field name in the section`,
|
||||||
{
|
fixtureData: `
|
||||||
description: `Address section validation only counts the number of different address field name in the section`,
|
|
||||||
fixtureData: `
|
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="postal-code" autocomplete="postal-code">
|
<input id="postal-code" autocomplete="postal-code">
|
||||||
<input id="email" autocomplete="email">
|
<input id="email" autocomplete="email">
|
||||||
<input id="email" autocomplete="email">
|
<input id="email" autocomplete="email">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
description: "A section with three fields but has duplicated email fields",
|
description:
|
||||||
invalid: true,
|
"A section with three fields but has duplicated email fields",
|
||||||
fields: [
|
invalid: true,
|
||||||
{ fieldName: "postal-code", reason: "autocomplete" },
|
fields: [
|
||||||
{ fieldName: "email", reason: "autocomplete" },
|
{ fieldName: "postal-code", reason: "autocomplete" },
|
||||||
{ fieldName: "email", 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
|
// - Fields without section name are merged to a section with section name
|
||||||
// - Two sections without name
|
// - Two sections without name
|
||||||
|
|
||||||
add_heuristic_tests(
|
add_heuristic_tests([
|
||||||
[
|
{
|
||||||
{
|
description: `One named billing section`,
|
||||||
description: `One named billing section`,
|
fixtureData: `
|
||||||
fixtureData: `
|
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="billing street-address">
|
<input id="street-address" autocomplete="billing street-address">
|
||||||
<input id="postal-code" autocomplete="billing postal-code">
|
<input id="postal-code" autocomplete="billing postal-code">
|
||||||
<input id="country" autocomplete="billing country">
|
<input id="country" autocomplete="billing country">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
addressType: "billing",
|
addressType: "billing",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `One billing section and one shipping section`,
|
{ fieldName: "country" },
|
||||||
fixtureData: `
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `One billing section and one shipping section`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="billing street-address">
|
<input id="street-address" autocomplete="billing street-address">
|
||||||
<input id="postal-code" autocomplete="billing postal-code">
|
<input id="postal-code" autocomplete="billing postal-code">
|
||||||
|
@ -49,34 +48,34 @@ add_heuristic_tests(
|
||||||
<input id="country" autocomplete="shipping country">
|
<input id="country" autocomplete="shipping country">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
addressType: "billing",
|
addressType: "billing",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
fields: [
|
||||||
default: {
|
{ fieldName: "street-address" },
|
||||||
reason: "autocomplete",
|
{ fieldName: "postal-code" },
|
||||||
addressType: "shipping",
|
{ fieldName: "country" },
|
||||||
},
|
],
|
||||||
fields: [
|
},
|
||||||
{ fieldName: "street-address" },
|
{
|
||||||
{ fieldName: "postal-code" },
|
default: {
|
||||||
{ fieldName: "country" },
|
reason: "autocomplete",
|
||||||
],
|
addressType: "shipping",
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `One billing section, one shipping section, and then billing section`,
|
{ fieldName: "country" },
|
||||||
fixtureData: `
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `One billing section, one shipping section, and then billing section`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="billing street-address">
|
<input id="street-address" autocomplete="billing street-address">
|
||||||
<input id="postal-code" autocomplete="billing postal-code">
|
<input id="postal-code" autocomplete="billing postal-code">
|
||||||
|
@ -86,34 +85,34 @@ add_heuristic_tests(
|
||||||
<input id="country" autocomplete="billing country">
|
<input id="country" autocomplete="billing country">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
addressType: "billing",
|
addressType: "billing",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
fields: [
|
||||||
default: {
|
{ fieldName: "street-address" },
|
||||||
reason: "autocomplete",
|
{ fieldName: "postal-code" },
|
||||||
addressType: "shipping",
|
{ fieldName: "country" },
|
||||||
},
|
],
|
||||||
fields: [
|
},
|
||||||
{ fieldName: "street-address" },
|
{
|
||||||
{ fieldName: "postal-code" },
|
default: {
|
||||||
{ fieldName: "country" },
|
reason: "autocomplete",
|
||||||
],
|
addressType: "shipping",
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `one section without a name and one billing section`,
|
{ fieldName: "country" },
|
||||||
fixtureData: `
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `one section without a name and one billing section`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="street-address">
|
<input id="street-address" autocomplete="street-address">
|
||||||
<input id="postal-code" autocomplete="postal-code">
|
<input id="postal-code" autocomplete="postal-code">
|
||||||
|
@ -123,33 +122,33 @@ add_heuristic_tests(
|
||||||
<input id="country" autocomplete="billing country">
|
<input id="country" autocomplete="billing country">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
fields: [
|
||||||
default: {
|
{ fieldName: "street-address" },
|
||||||
reason: "autocomplete",
|
{ fieldName: "postal-code" },
|
||||||
addressType: "billing",
|
{ fieldName: "country" },
|
||||||
},
|
],
|
||||||
fields: [
|
},
|
||||||
{ fieldName: "street-address" },
|
{
|
||||||
{ fieldName: "postal-code" },
|
default: {
|
||||||
{ fieldName: "country" },
|
reason: "autocomplete",
|
||||||
],
|
addressType: "billing",
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `One billing section and one section without a name`,
|
{ fieldName: "country" },
|
||||||
fixtureData: `
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `One billing section and one section without a name`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="billing street-address">
|
<input id="street-address" autocomplete="billing street-address">
|
||||||
<input id="postal-code" autocomplete="billing postal-code">
|
<input id="postal-code" autocomplete="billing postal-code">
|
||||||
|
@ -159,33 +158,33 @@ add_heuristic_tests(
|
||||||
<input id="country" autocomplete="country">
|
<input id="country" autocomplete="country">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
addressType: "billing",
|
addressType: "billing",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
fields: [
|
||||||
default: {
|
{ fieldName: "street-address" },
|
||||||
reason: "autocomplete",
|
{ fieldName: "postal-code" },
|
||||||
},
|
{ fieldName: "country" },
|
||||||
fields: [
|
],
|
||||||
{ fieldName: "street-address" },
|
},
|
||||||
{ fieldName: "postal-code" },
|
{
|
||||||
{ fieldName: "country" },
|
default: {
|
||||||
],
|
reason: "autocomplete",
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `Fields without section name are merged (test both before and after the section with a name)`,
|
{ fieldName: "country" },
|
||||||
fixtureData: `
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `Fields without section name are merged (test both before and after the section with a name)`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="name" autocomplete="name">
|
<input id="name" autocomplete="name">
|
||||||
<input id="street-address" autocomplete="billing street-address">
|
<input id="street-address" autocomplete="billing street-address">
|
||||||
|
@ -197,36 +196,36 @@ add_heuristic_tests(
|
||||||
<input id="name" autocomplete="name">
|
<input id="name" autocomplete="name">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
addressType: "billing",
|
addressType: "billing",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "name", addressType: "" },
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
fields: [
|
||||||
default: {
|
{ fieldName: "name", addressType: "" },
|
||||||
reason: "autocomplete",
|
{ fieldName: "street-address" },
|
||||||
addressType: "shipping",
|
{ fieldName: "postal-code" },
|
||||||
},
|
{ fieldName: "country" },
|
||||||
fields: [
|
],
|
||||||
{ fieldName: "street-address" },
|
},
|
||||||
{ fieldName: "postal-code" },
|
{
|
||||||
{ fieldName: "country" },
|
default: {
|
||||||
{ fieldName: "name", addressType: "" },
|
reason: "autocomplete",
|
||||||
],
|
addressType: "shipping",
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `Fields without section name are merged, but do not merge if the field already exists`,
|
{ fieldName: "country" },
|
||||||
fixtureData: `
|
{ fieldName: "name", addressType: "" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `Fields without section name are merged, but do not merge if the field already exists`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="name" autocomplete="name">
|
<input id="name" autocomplete="name">
|
||||||
<input id="street-address" autocomplete="billing street-address">
|
<input id="street-address" autocomplete="billing street-address">
|
||||||
|
@ -235,30 +234,28 @@ add_heuristic_tests(
|
||||||
<input id="name" autocomplete="name">
|
<input id="name" autocomplete="name">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
addressType: "billing",
|
addressType: "billing",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "name", addressType: "" },
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
fields: [
|
||||||
invalid: true,
|
{ fieldName: "name", addressType: "" },
|
||||||
fields: [
|
{ fieldName: "street-address" },
|
||||||
{ fieldName: "name", reason: "autocomplete" },
|
{ fieldName: "postal-code" },
|
||||||
],
|
{ fieldName: "country" },
|
||||||
},
|
],
|
||||||
],
|
},
|
||||||
},
|
{
|
||||||
{
|
invalid: true,
|
||||||
description: `Fields without section name are merged (multi-fields)`,
|
fields: [{ fieldName: "name", reason: "autocomplete" }],
|
||||||
fixtureData: `
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `Fields without section name are merged (multi-fields)`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="billing street-address">
|
<input id="street-address" autocomplete="billing street-address">
|
||||||
<input id="postal-code" autocomplete="billing postal-code">
|
<input id="postal-code" autocomplete="billing postal-code">
|
||||||
|
@ -267,25 +264,25 @@ add_heuristic_tests(
|
||||||
<input id="email" autocomplete="email">
|
<input id="email" autocomplete="email">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
addressType: "billing",
|
addressType: "billing",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
{ fieldName: "email", addressType: "" },
|
|
||||||
{ fieldName: "email", addressType: "" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
fields: [
|
||||||
},
|
{ fieldName: "street-address" },
|
||||||
{
|
{ fieldName: "postal-code" },
|
||||||
description: `Two sections without name`,
|
{ fieldName: "country" },
|
||||||
fixtureData: `
|
{ fieldName: "email", addressType: "" },
|
||||||
|
{ fieldName: "email", addressType: "" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: `Two sections without name`,
|
||||||
|
fixtureData: `
|
||||||
<html><body>
|
<html><body>
|
||||||
<input id="street-address" autocomplete="street-address">
|
<input id="street-address" autocomplete="street-address">
|
||||||
<input id="postal-code" autocomplete="postal-code">
|
<input id="postal-code" autocomplete="postal-code">
|
||||||
|
@ -295,28 +292,27 @@ add_heuristic_tests(
|
||||||
<input id="country" autocomplete="country">
|
<input id="country" autocomplete="country">
|
||||||
</body></html>
|
</body></html>
|
||||||
`,
|
`,
|
||||||
expectedResult: [
|
expectedResult: [
|
||||||
{
|
{
|
||||||
default: {
|
default: {
|
||||||
reason: "autocomplete",
|
reason: "autocomplete",
|
||||||
},
|
|
||||||
fields: [
|
|
||||||
{ fieldName: "street-address" },
|
|
||||||
{ fieldName: "postal-code" },
|
|
||||||
{ fieldName: "country" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
{
|
fields: [
|
||||||
default: {
|
{ fieldName: "street-address" },
|
||||||
reason: "autocomplete",
|
{ 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" },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче