28
28
<!-- for some reason, if we don't have 'accesskey' here, adding it dynamically later
30
30
<button id="button" accesskey="z">Hello</button>
31
<input type="text" id="textbox" value=""/>
32
33
<div id="content" style="display: none">
119
function synthesizeKey(aEvent)
121
function synthesizeKey(aEvent, aFocusElementId)
121
document.getElementById("button").focus();
123
document.getElementById(aFocusElementId).focus();
123
125
synthesizeNativeKey(keyboardLayouts[aEvent.layout],
124
126
aEvent.keyCode, aEvent, aEvent.chars, aEvent.unmodifiedChars);
501
function runTextInputTests()
503
var textbox = document.getElementById("textbox");
505
function testKey(aEvent, aExpectText) {
509
synthesizeKey(aEvent, "textbox");
511
var name = eventToString(aEvent);
513
is(textbox.value, aExpectText, name + " does not input correct text.");
516
if (navigator.platform.indexOf("Win") == 0) {
517
// Basic sanity checks
518
testKey({layout:"US", keyCode:65, chars:"a"},
520
testKey({layout:"US", keyCode:65, shift:1, chars:"A"},
522
// When Ctrl+Alt are pressed, any text should not be inputted.
523
testKey({layout:"US", keyCode:65, ctrl:1, alt:1, chars:""},
526
// Lithuanian AltGr should be consumed at 9/0 keys pressed
527
testKey({layout:"Lithuanian", keyCode:56, chars:"\u016B"},
529
testKey({layout:"Lithuanian", keyCode:57, chars:"9"},
531
testKey({layout:"Lithuanian", keyCode:48, chars:"0"},
533
testKey({layout:"Lithuanian", keyCode:56, ctrl:1, alt:1, chars:"8"},
535
testKey({layout:"Lithuanian", keyCode:57, ctrl:1, alt:1, chars:"9"},
537
testKey({layout:"Lithuanian", keyCode:48, ctrl:1, alt:1, chars:"0"},
499
542
function runTest()
502
545
runAccessKeyTests();
503
546
runXULKeyTests();
504
548
SimpleTest.finish();