Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
-->
<window title="Mozilla Bug 1181560"
onload="SimpleTest.waitForFocus(nextTest, window)">
<!-- test results are displayed in the html:body -->
target="_blank">Mozilla Bug 1181560</a>
</body>
<vbox>
<menubar>
<menu id="menu" label="MyMenu">
<menupopup>
<menuitem label="A"/>
<menu id="b" label="B">
<menupopup>
<menuitem label="B1"/>
</menupopup>
</menu>
<menu id="c" label="C">
<menupopup>
<menuitem label="C1"/>
</menupopup>
</menu>
</menupopup>
</menu>
</menubar>
</vbox>
<!-- test code goes here -->
<script type="application/javascript">
<![CDATA[
/** Test for Bug 1181560 **/
SimpleTest.waitForExplicitFinish();
let menuB, menuC, mainMenu, menuBOpen, menuCOpen;
let menuBOpenCount = 0;
function handleBOpens() {
menuBOpenCount++;
menuBOpen = true;
ok(!menuCOpen, "Menu C should not be open when menu B has opened");
if (menuBOpenCount >= 2) {
SimpleTest.finish();
return;
}
sendKey("LEFT", window);
sendKey("DOWN", window);
sendKey("RIGHT", window);
}
function handleBCloses() {
menuBOpen = false;
}
function handleCOpens() {
menuCOpen = true;
ok(!menuBOpen, "Menu B should not be open when menu C has opened");
synthesizeMouseAtCenter(menuB, {}, window);
}
function handleCCloses() {
menuCOpen = false;
}
function nextTest(e) {
mainMenu = document.getElementById("menu");
menuB = document.getElementById("b");
menuC = document.getElementById("c");
menuB.menupopup.addEventListener("popupshown", handleBOpens);
menuB.menupopup.addEventListener("popuphidden", handleBCloses);
menuC.menupopup.addEventListener("popupshown", handleCOpens);
menuC.menupopup.addEventListener("popuphidden", handleCCloses);
mainMenu.addEventListener("popupshown", ev => {
synthesizeMouseAtCenter(menuB, {}, window);
});
mainMenu.open = true;
}
]]>
</script>
</window>