chromium/third_party/blink/web_tests/fast/forms/text/input-selection-hidden.html

<html>
<head>
<script>
function log(msg) {
    document.getElementById('res').innerHTML = document.getElementById('res').innerHTML + msg + "<br>";
}
    
function test () {
    if (window.testRunner)
        testRunner.dumpAsText();

    var tf = document.getElementById('tf');

    tf.setSelectionRange(3, 12);
    log("setSelectionRange(3, 12)");
    if (tf.selectionStart == 3 && tf.selectionEnd == 12)
        log("Passed.");
    else
        log("Failed. selection start: " + tf.selectionStart + " selection end: " + tf.selectionEnd);
        
    tf.style.visibility = "visible";
}
</script>
</head>
<body onload="test()">
This tests the selection methods on the new text field when it is hidden and then made visible.
<p>
<input type="text" id="tf" style="visibility:hidden" value="123456789 ABCDEFGHIJ"></input>
<div id="res"></div>
</p>
</body>
</html>