blob: c1e5d6b0c21296d589a865d78f5ca1453ea6feb7 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>Inserting text</title>
<style>
input {
padding: 15px;
border-style: none;
box-sizing: border-box;
font-size: 14px;
height: 1.8em;
background-color: yellow;
}
</style>
</head>
<body>
<p>This tests inserting text ("b") into a text field with specific CSS
and an already existing text ("a").
To manually test, copy and paste some text into the text field below.
Pasting should work as expected.</p>
<input type="text" id="input" value="a" />
<div id="log"></div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var input = document.getElementById("input");
input.setSelectionRange(1, 1);
document.execCommand("InsertHTML", false, "b");
if (input.value == "ab")
log.innerText = "PASSED the final text is 'ab'.";
else
log.innerText = "FAILED the final text is not 'ab'.";
</script>
</body>
</html>