From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../browser_section_validation_address.js | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js (limited to 'browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js') 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 new file mode 100644 index 0000000000..2e9cf42ab0 --- /dev/null +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_section_validation_address.js @@ -0,0 +1,79 @@ +/* Any copyright is dedicated to the Public Domain. +http://creativecommons.org/publicdomain/zero/1.0/ */ + +/* global add_heuristic_tests */ + +"use strict"; + +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" }, + ], + }, + ], + }, + { + description: `An address section is invalid when it contains less than threee fields`, + 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" }, + ], + }, + ], + }, +]); -- cgit v1.2.3