blob: fcc2542f2cc67edd6811f0bf575595bfe7df58da [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<p>This tests pasting two lines of text copied from pre content.
To manually test, copy the selected text (including the new line) and paste it into textarea twice.
There should be no blank line between two pasted lines.</p>
<pre oncopy="setTimeout(function () { textarea.focus(); }, 0);">A line of text
some other text
</pre>
<textarea cols="10" rows="5" oninput="document.getElementById('console').textContent = textarea.value;"></textarea>
<pre id="console"></pre>
<script>
if (window.testRunner)
testRunner.dumpAsText();
var textarea = document.querySelector('textarea');
getSelection().collapse(document.querySelector('pre'), 0);
getSelection().modify('extend', 'forward', 'line');
if (document.queryCommandSupported('paste')) {
document.execCommand('copy', false, null);
textarea.focus();
document.execCommand('paste', false, null);
document.execCommand('paste', false, null);
}
</script>
</body>
</html>