<!DOCTYPE html>
<html>
<body>
<textarea cols=50 rows=10>first
second</textarea>
<script src="../../resources/js-test-pre.js"></script>
<p id="console"></p>
<script>

if (window.testRunner)
    testRunner.dumpAsText();

var textarea = document.querySelector('textarea');

function selectFirstLineIncludingLineBreak() {
    textarea.focus();
    textarea.setSelectionRange(0, 0);
    getSelection().modify('extend', 'forward', 'line');
}

function copyPaste() {
    document.execCommand('copy');
    document.execCommand('paste');
}

var offsetAfterLineBreak = 6;
shouldBe("selectFirstLineIncludingLineBreak(); copyPaste(); textarea.selectionEnd", "offsetAfterLineBreak");

</script>
</body>
</html>
