44 lines
807 B
HTML
44 lines
807 B
HTML
<html>
|
|
<head>
|
|
<script>
|
|
|
|
var logDiv;
|
|
|
|
function log(msg, success)
|
|
{
|
|
logDiv.appendChild(document.createElement('div')).textContent = msg + ': ' + (success ? 'PASS' : 'FAIL');
|
|
}
|
|
|
|
function typeInto(element, value)
|
|
{
|
|
if (!window.eventSender)
|
|
return;
|
|
|
|
element.focus();
|
|
eventSender.keyDown(value, []);
|
|
}
|
|
|
|
function runTest()
|
|
{
|
|
if (window.testRunner)
|
|
testRunner.dumpAsText();
|
|
|
|
logDiv = document.getElementById('log');
|
|
var input = document.getElementsByTagName('input')[0];
|
|
var count = 0;
|
|
input.addEventListener('input', function()
|
|
{
|
|
count++;
|
|
}, false);
|
|
typeInto(input, 'x');
|
|
log('Input event should fire once per actual input', count == 1);
|
|
}
|
|
|
|
</script>
|
|
</head>
|
|
<body onload="runTest()">
|
|
<input>
|
|
<div id="log"></div>
|
|
</body>
|
|
</html>
|