Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / selection / 5213963.html
blob2f5dd4bf94df0a01692d931afdd374d07cc3f72b
1 <p>This tests to see that a selection inside an input field is removed when clicking (and focusing) a button in the same frame.</p>
2 <input id="input" type="text" value="After you click the button below, this content should not be selected." size="60"><br>
3 <input id="button" type="button" value="Click Me"><br>
4 <ul id="console"></ul>
6 <script>
7 function log(msg) {
8 console = document.getElementById("console");
9 li = document.createElement("li");
10 text = document.createTextNode(msg);
11 console.appendChild(li);
12 li.appendChild(text);
15 if (window.testRunner)
16 testRunner.dumpAsText();
17 var input = document.getElementById("input");
18 input.focus();
19 input.setSelectionRange(0, input.value.length);
20 if (!input.selectionEnd)
21 log("Failure: There was no selection inside the input field when the test began.");
22 if (!window.eventSender)
23 log("Test not run because there is no event sender.");
24 else {
25 var button = document.getElementById("button");
26 var x = button.offsetParent.offsetLeft + button.offsetLeft + button.offsetWidth / 2;
27 var y = button.offsetParent.offsetTop + button.offsetTop + button.offsetHeight / 2;
28 eventSender.mouseMoveTo(x, y);
29 eventSender.mouseDown();
30 eventSender.mouseUp();
31 if (!input.selectionEnd)
32 log("Failure: There was still a selection after clicking a button.");
33 log("Success");
35 </script>