summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/forms/browser_selectpopup_focus.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/forms/browser_selectpopup_focus.js')
-rw-r--r--browser/base/content/test/forms/browser_selectpopup_focus.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/browser/base/content/test/forms/browser_selectpopup_focus.js b/browser/base/content/test/forms/browser_selectpopup_focus.js
new file mode 100644
index 0000000000..24ff947c50
--- /dev/null
+++ b/browser/base/content/test/forms/browser_selectpopup_focus.js
@@ -0,0 +1,38 @@
+// Empty select to make sure that we click on the menulist button.
+const PAGE = `
+<!doctype html>
+<select style="padding: 0">
+ <option></option>
+</select>
+`;
+
+function tick() {
+ return new Promise(r =>
+ requestAnimationFrame(() => requestAnimationFrame(r))
+ );
+}
+
+add_task(async function () {
+ const url = "data:text/html," + encodeURI(PAGE);
+ await BrowserTestUtils.withNewTab(
+ {
+ gBrowser,
+ url,
+ },
+ async function (browser) {
+ await openSelectPopup("click");
+ await SpecialPowers.spawn(browser, [], () => {
+ is(
+ content.document.activeElement,
+ content.document.querySelector("select"),
+ "Select is the active element"
+ );
+ ok(
+ content.document.querySelector("select").matches(":focus"),
+ "Select matches :focus"
+ );
+ });
+ await hideSelectPopup();
+ }
+ );
+});