summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/text/input-select-on-click.html
blob: 2c60223a7d46b0378975c1ef0db1a1806ae4027d (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
<html>
<head>
<script>
function test() {
    if (window.testRunner)
        testRunner.dumpAsText();
    var tf = document.getElementById('tf');
    var x = tf.offsetLeft + tf.offsetWidth / 2;
    var y = tf.offsetTop + tf.offsetHeight / 2;
    if (window.eventSender) {
        eventSender.mouseMoveTo(x, y);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
    if (tf.selectionStart == 0 && tf.selectionEnd == 10) { // ;
        document.getElementById("result").innerHTML = "PASS";
    } else {
        document.getElementById("result").innerHTML = "FAIL: selection start is "
            + tf.selectionStart + " and end is " + tf.selectionEnd + ".";
    }
}
</script>
</head>
<body onload="test()">
<p>Tests behavior of code that calls select() inside an onclick handler. The entire field should end up selected.</p>
<p>The test runs only under DumpRenderTree with eventSender; if you test by hand the test result below will say FAIL.</p>
<p><input type="text" id="tf" onclick="this.select()" value="input text"></input></p>
<p id="result">TEST NOT RUN YET</p>
</body>
</html>