Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window title="Menu with Mouse Capture"
<menulist id="menulist">
<menupopup onpopupshown="shown(this)" onpopuphidden="done();">
<menuitem id="menuitem" label="Menu Item"
onmousemove="moveHappened = true;"
onmouseup="upHappened = true;"/>
</menupopup>
</menulist>
<script class="testbody" type="application/javascript">
<![CDATA[
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(startTest);
let moveHappened = false, upHappened = false;
function startTest() {
disableNonTestMouseEvents(true);
document.getElementById("menulist"). open = true;
}
function shown(popup)
{
popup.setCaptureAlways();
setTimeout(function() {
synthesizeMouseAtCenter(document.getElementById("menuitem"), { type: "mousemove" });
synthesizeMouseAtCenter(document.getElementById("menuitem"), { type: "mouseup" });
}, 200);
}
function done()
{
ok(moveHappened, "mousemove happened");
ok(upHappened, "mouseup happened");
disableNonTestMouseEvents(false);
SimpleTest.finish();
}
]]>
</script>
<p id="display">
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</window>