Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / search-delete-while-cancel-button-clicked.html
blobd668829fdaf1381aa7e3c00cc69b4cfadba0122f
1 <html>
2 <head>
3 <script>
4 function log(msg)
6 var console = document.getElementById('console');
7 console.innerHTML = console.innerHTML + msg + "<br>";
10 function buttonClick()
12 log("<br>clicking button");
14 // click the button
15 var button = document.getElementById('button');
16 eventSender.mouseMoveTo(button.offsetLeft + 20, button.offsetTop + 7);
17 eventSender.mouseDown();
18 eventSender.mouseUp();
20 testRunner.notifyDone();
23 function deleteSearch()
25 // delete the search
26 log("<br>deleting search input");
27 var search = document.getElementById('search');
28 search.parentNode.removeChild(search);
30 setTimeout(buttonClick, 10);
33 function drag()
35 if (!window.testRunner)
36 return;
38 testRunner.dumpAsText();
39 testRunner.waitUntilDone();
41 var search = document.getElementById('search');
42 var x = search.offsetLeft + search.offsetWidth - 6;
43 var y = search.offsetTop + search.offsetHeight / 2;
45 // drag slider, leave the mouse down
46 log("clicking in cancel");
47 eventSender.mouseMoveTo(x, y);
48 eventSender.mouseDown();
50 setTimeout(deleteSearch, 10);
52 </script>
53 </head>
54 <body onload="drag()">
55 This tests that events don't continue to target a search cancel button if it is deleted while mouse is down.
56 <br>
57 <input type="button" id="button" value="Click Me!" onmouseup="log('button click!')">
58 <br>
59 <input id="search" type="search" value="foo">
60 <div id="console"></div>
61 </body>
62 </html>