summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/text/text-input-event.html
blob: 8f7c6b8dd9d22d6d92b463eb34b1272a9001208a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<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>