blob: ecb399dceaed32707f7ac0b0ca19f09c07ef5735 [file] [log] [blame]
<html>
<head>
<script>
function log(message)
{
var item = document.createElement("li");
item.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(item);
}
function pressKey(key)
{
var event = document.createEvent("KeyboardEvent");
event.initKeyboardEvent("keydown", true, true, document.defaultView, key, 0, true, false, false, false, false);
document.dispatchEvent(event);
}
function test()
{
if (window.layoutTestController)
layoutTestController.dumpAsText();
for(i = 1; i <= 9; i++) {
pressKey(i);
}
pressKey("a");
pressKey("b");
pressKey("c");
pressKey("d");
}
</script>
</head>
<body onload="test()">
<p>This test checks to see if accesskey attributes works on the specified elements.</p>
<p>If this test passes you should see 1 - 9 and a, b and c clicked or focussed.</p>
<hr>
<p>
<button accesskey="1" onclick="log('1 button clicked')"></button>
<input type="button" value="Click me!" accesskey="2" onfocus="log('2 input type button focussed')"/>
<input type="checkbox" accesskey="3" onfocus="log('3 input type checkbox focussed')"/>
<input type="text" accesskey="4" onfocus="log('4 input type text focussed')"/>
<input type="submit" accesskey="5" onfocus="log('5 input type submit clicked')"/>
<input type="reset" accesskey="6" onfocus="log('6 input type reset clicked')"/>
<a href="#" accesskey="7" onclick="log('7 link clicked')"></a>
<fieldset><legend accesskey="8"></legend><input type="text" onfocus="log('8 input type associated to legend focussed')"/></fieldset>
<label accesskey="9" for="test1"><input type="text" id="test1" onfocus="log('9 input type associated to label around input focussed')"/></label>
<label accesskey="a" for="test2"></label><input type="text" id="test2" onfocus="log('a input type associated to label closed before input focussed')"/>
<map name="mymap">
<area accesskey="b" shape="rect" coords="0,0,5,10" alt="" href="#" onclick="log('b area 1 clicked')">
<area accesskey="c" shape="rect" coords="6,0,10,10" alt="" href="#" onclick="log('c area 2 clicked')">
</map>
<img usemap="#mymap" alt="pic" src="#" height="10" width="10"/>
</p>
<hr>
<ol id="console"></ol>
</body>
</html>