blob: 5b0e8acf4b31d88565e1e76a48e0766041df4b57 [file] [log] [blame]
<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>
<input id="input" type="text" value="After you click the button below, this content should not be selected." size="60"><br>
<input id="button" type="button" value="Click Me"><br>
<ul id="console"></ul>
<script>
function log(msg) {
console = document.getElementById("console");
li = document.createElement("li");
text = document.createTextNode(msg);
console.appendChild(li);
li.appendChild(text);
}
var input = document.getElementById("input");
input.focus();
input.setSelectionRange(0, input.value.length);
if (window.layoutTestController) {
if (window.getSelection().type == "None")
log("Failure: There was no selection inside the input field when the test began.")
var button = document.getElementById("button");
var x = button.offsetParent.offsetLeft + button.offsetLeft + button.offsetWidth / 2;
var y = button.offsetParent.offsetTop + button.offsetTop + button.offsetHeight / 2;
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
if (window.getSelection().type != "None")
log("Failure: There was still a selection after clicking a button.")
}
</script>