diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js')
-rw-r--r-- | browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js new file mode 100644 index 0000000000..f775d7e5fb --- /dev/null +++ b/browser/extensions/formautofill/test/browser/heuristics/browser_sections_with_invisible_fields.js @@ -0,0 +1,131 @@ +/* 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: `Create a new section when the section already has a field with the same field name`, + fixtureData: ` + <html><body> + <input type="text" autocomplete="cc-number"/> + <input type="text" autocomplete="cc-name"/> + <input type="text" autocomplete="cc-exp"/> + <input type="text" autocomplete="cc-exp"/> + </body></html> + `, + expectedResult: [ + { + default: { + reason: "autocomplete", + }, + fields: [ + { fieldName: "cc-number" }, + { fieldName: "cc-name" }, + { fieldName: "cc-exp" }, + ], + }, + { + fields: [{ fieldName: "cc-exp", reason: "autocomplete" }], + }, + ], + }, + { + description: `Do not create a new section for an invisible field`, + fixtureData: ` + <html><body> + <input type="text" autocomplete="cc-number"/> + <input type="text" autocomplete="cc-name"/> + <input type="text" autocomplete="cc-exp"/> + <input type="text" autocomplete="cc-exp" style="display:none"/> + </body></html> + `, + expectedResult: [ + { + default: { + reason: "autocomplete", + }, + fields: [ + { fieldName: "cc-number" }, + { fieldName: "cc-name" }, + { fieldName: "cc-exp" }, + { fieldName: "cc-exp" }, + ], + }, + ], + }, + { + description: `Do not create a new section when the field with the same field name is an invisible field`, + fixtureData: ` + <html><body> + <input type="text" autocomplete="cc-number""/> + <input type="text" autocomplete="cc-name"/> + <input type="text" autocomplete="cc-exp" style="display:none"/> + <input type="text" autocomplete="cc-exp"/> + </body></html> + `, + expectedResult: [ + { + default: { + reason: "autocomplete", + }, + fields: [ + { fieldName: "cc-number" }, + { fieldName: "cc-name" }, + { fieldName: "cc-exp" }, + { fieldName: "cc-exp" }, + ], + }, + ], + }, + { + description: `Do not create a new section for an invisible field (match field is not adjacent)`, + fixtureData: ` + <html><body> + <input type="text" autocomplete="cc-number"/> + <input type="text" autocomplete="cc-name"/> + <input type="text" autocomplete="cc-exp"/> + <input type="text" autocomplete="cc-number" style="display:none"/> + </body></html> + `, + expectedResult: [ + { + default: { + reason: "autocomplete", + }, + fields: [ + { fieldName: "cc-number" }, + { fieldName: "cc-name" }, + { fieldName: "cc-exp" }, + { fieldName: "cc-number" }, + ], + }, + ], + }, + { + description: `Do not create a new section when the field with the same field name is an invisible field (match field is not adjacent)`, + fixtureData: ` + <html><body> + <input type="text" autocomplete="cc-number" style="display:none"/> + <input type="text" autocomplete="cc-name"/> + <input type="text" autocomplete="cc-exp"/> + <input type="text" autocomplete="cc-number"/> + </body></html> + `, + expectedResult: [ + { + default: { + reason: "autocomplete", + }, + fields: [ + { fieldName: "cc-number" }, + { fieldName: "cc-name" }, + { fieldName: "cc-exp" }, + { fieldName: "cc-number" }, + ], + }, + ], + }, +]); |