Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<?xml version="1.0"?>
<head>
<meta charset="utf-8" />
<title><!-- Test with dialog & buttons --></title>
<link rel="stylesheet" href="chrome://global/skin"/>
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script><![CDATA[
add_task(async function test_panel_submenu_hover() {
let panel = document.getElementById("panel");
let menu = document.getElementById("menu");
let menupopup = document.getElementById("menupopup");
let panelShown = new Promise(r => panel.addEventListener("popupshown", r, { once: true }));
info("opening panel");
panel.openPopupAtScreen(window.screenX, window.screenY);
await panelShown;
info("panel shown");
info("hovering menu button");
synthesizeMouseAtCenter(menu, { type: "mousemove" });
// Wait for at least the submenu delay.
await new Promise(r => setTimeout(r, 1000));
is(menupopup.state, "closed", "menu shouldn't have opened");
info("clicking menu button");
let menupopupShown = new Promise(r => menupopup.addEventListener("popupshown", r, { once: true }));
synthesizeMouseAtCenter(menu, {});
await menupopupShown;
ok(true, "Menupopup was shown on click");
});
]]></script>
</head>
<body>
<xul:panel id="panel">
<xul:button type="menu" id="menu" label="Open menu">
<xul:menupopup id="menupopup">
<xul:menuitem label="foo"/>
</xul:menupopup>
</xul:button>
</xul:panel>
</body>
</html>