mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
89 lines
2.6 KiB
XML
89 lines
2.6 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
|
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
|
|
|
|
<window title="Menulist Key Navigation Tests"
|
|
onload="setTimeout(runTests, 0);"
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
|
|
|
<title>Menulist Key Navigation Tests</title>
|
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<menulist id="list">
|
|
<menupopup>
|
|
<menuitem id="i1" label="One"/>
|
|
<menuitem id="i2" label="Two"/>
|
|
<menuitem id="i2b" disabled="true" label="Two and a Half"/>
|
|
<menuitem id="i3" label="Three"/>
|
|
<menuitem id="i4" label="Four"/>
|
|
</menupopup>
|
|
</menulist>
|
|
|
|
<script class="testbody" type="application/javascript">
|
|
<![CDATA[
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
var iswin = (navigator.platform.indexOf("Win") == 0);
|
|
|
|
function runTests()
|
|
{
|
|
var list = $("list");
|
|
list.focus();
|
|
// on Mac, up and cursor keys open the menu, but on other platforms, the
|
|
// cursor keys navigate between items without opening the menu
|
|
if (navigator.platform.indexOf("Mac") == -1) {
|
|
keyCheck(list, "VK_DOWN", 2, "cursor down");
|
|
keyCheck(list, "VK_DOWN", iswin ? "2b" : 3, "cursor down skip disabled");
|
|
keyCheck(list, "VK_UP", 2, "cursor up skip disabled");
|
|
keyCheck(list, "VK_UP", 1, "cursor up");
|
|
keyCheck(list, "VK_UP", 4, "cursor up wrap");
|
|
keyCheck(list, "VK_DOWN", 1, "cursor down wrap");
|
|
}
|
|
|
|
synthesizeKey("G", { });
|
|
is(list.selectedItem, $("i1"), "letter pressed not found selectedItem");
|
|
|
|
keyCheck(list, "T", 2, "letter pressed");
|
|
keyCheck(list, "T", 2, "letter pressed");
|
|
setTimeout(pressedAgain, 1200);
|
|
}
|
|
|
|
function pressedAgain()
|
|
{
|
|
var list = $("list");
|
|
keyCheck(list, "T", iswin ? "2b" : 3, "letter pressed again");
|
|
keyCheck(list, "W", 2, "second letter pressed");
|
|
setTimeout(differentPressed, 1200);
|
|
}
|
|
|
|
function differentPressed()
|
|
{
|
|
keyCheck($("list"), "O", 1, "different letter pressed");
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
function keyCheck(list, key, index, testname)
|
|
{
|
|
var item = $("i" + index);
|
|
synthesizeKeyExpectEvent(key, { }, item, "command", testname);
|
|
is(list.selectedItem, item, testname + " selectedItem");
|
|
}
|
|
|
|
]]>
|
|
</script>
|
|
|
|
<body xmlns="http://www.w3.org/1999/xhtml">
|
|
<p id="display">
|
|
</p>
|
|
<div id="content" style="display: none">
|
|
</div>
|
|
<pre id="test">
|
|
</pre>
|
|
</body>
|
|
|
|
</window>
|