summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/forms/search-click-in-placeholder.html
blob: ba213bc3607da0e7560bd0a9c668434df42fd3d4 (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
<body onload="test()">
    <input type="search" id="target" placeholder="Placeholder text" onfocus="window.hasFocus=1">
    <pre id="console"></pre>
    <script>
        var hasFocus = 0;

        function log(message) {
            document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
        }

        function test() {
            if (!window.eventSender)
                return;

            layoutTestController.dumpAsText();

            var target = document.getElementById("target");
            var x = target.offsetParent.offsetLeft + target.offsetLeft + target.offsetWidth / 2;
            var y = target.offsetParent.offsetTop + target.offsetTop + target.offsetHeight / 2;

            eventSender.mouseMoveTo(x, y);
            eventSender.mouseDown();
            eventSender.mouseUp();

            log(hasFocus ? "PASS" : "FAIL");
        }
    </script>
</body>