blob: ef1b73f83f3c296f9214c84dfdfe1eca2feb0976 [file] [log] [blame]
<div>Tests that setting selectionEnd on a blurred text control does not clobber selectionStart.</div>
<textarea>This is dummy text. This is dummy text.</textarea>
<input value="This is dummy text. This is dummy text">
<pre id="logger"></pre>
<script>
if (window.testRunner)
testRunner.dumpAsText();
function assert(property, actual, expected)
{
if (expected == actual)
result = "PASS";
else
result = "FAIL: " + property + " was " + actual + " expected " + expected + ".";
document.getElementById('logger').innerHTML += result + "\n";
}
function runTest(editArea)
{
editArea.selectionStart = 10;
editArea.blur();
assert("selectionStart", editArea.selectionStart, 10);
editArea.selectionEnd = 20;
assert("selectionStart", editArea.selectionStart, 10);
assert("selectionEnd", editArea.selectionEnd, 20);
}
runTest(document.querySelector('textarea'));
runTest(document.querySelector('input'));
</script>