From 43a97878ce14b72f0981164f87f2e35e14151312 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 11:22:09 +0200 Subject: Adding upstream version 110.0.1. Signed-off-by: Daniel Baumann --- .../test/unit/test_findLabelElements.js | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 browser/extensions/formautofill/test/unit/test_findLabelElements.js (limited to 'browser/extensions/formautofill/test/unit/test_findLabelElements.js') diff --git a/browser/extensions/formautofill/test/unit/test_findLabelElements.js b/browser/extensions/formautofill/test/unit/test_findLabelElements.js new file mode 100644 index 0000000000..bf9d36f102 --- /dev/null +++ b/browser/extensions/formautofill/test/unit/test_findLabelElements.js @@ -0,0 +1,103 @@ +"use strict"; + +var LabelUtils; +add_task(async function() { + ({ LabelUtils } = ChromeUtils.import( + "resource://autofill/FormAutofillUtils.jsm" + )); +}); + +const TESTCASES = [ + { + description: "Input contains in a label element.", + document: `
+ +
`, + inputId: "typeA", + expectedLabelIds: ["labelA"], + }, + { + description: "Input contains in a label element.", + document: ``, + inputId: "typeB", + expectedLabelIds: ["labelB"], + }, + { + description: '"for" attribute used to indicate input by one label.', + document: ` + `, + inputId: "typeC", + expectedLabelIds: ["labelC"], + }, + { + description: '"for" attribute used to indicate input by multiple labels.', + document: `
+ + + + +
`, + inputId: "typeD", + expectedLabelIds: ["labelD1", "labelD2", "labelD3"], + }, + { + description: + '"for" attribute used to indicate input by multiple labels with space prefix/postfix.', + document: ` + + + + `, + inputId: " typeE ", + expectedLabelIds: [], + }, + { + description: "Input contains in a label element.", + document: `