blob: 308376a04d3c10902f897638df98a97510c23d22 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<style>
#textarea {
font-family: Ahem;
font-size: 16px;
color: rgba(0, 0, 0, 0.2);
-webkit-font-smoothing: none;
}
</style>
</head>
<body>
This tests smart pasting in a text control.
To manually test, double click the middle word in the text area below. Then cut and paste.
It should result in the original text. The space before the middle word should not be lost.
<div>
<textarea id="textarea">Hello world test</textarea>
</div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
if (window.eventSender) {
function doubleClick(x, y) {
eventSender.mouseMoveTo(x, y);
eventSender.mouseDown();
eventSender.mouseUp();
eventSender.mouseDown();
eventSender.mouseUp();
}
var target = document.getElementById("textarea");
var x = target.offsetLeft + 120;
var y = target.offsetTop + 10;
doubleClick(x, y);
document.execCommand("Cut");
document.execCommand("Paste");
if (target.value == "Hello world test")
document.write("PASS: Smart cutting and pasting result in the original text.");
else
document.write("FAIL: Smart cutting and pasting do not result in the original text.");
} else {
document.write("This test can't run automatically in web browser without eventSender.");
}
</script>
</body>
</html>