summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/editing/input/paste-linebreak-into-initially-hidden-textarea.html
blob: 10b7d6ab63c0d2a888eb38de9a390a002dd66a58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!DOCTYPE html>
<html>
<body>
<p>This tests pasting into a textarea that starts with a line break that didn't initially have a renderer (display: none).
WebKit should still be able to paste text with line breaks.</p>
<textarea id="test" style="display: none" cols="50" rows="10"></textarea>
<div id="log"></div>
<script type="text/javascript">

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

var textarea = document.querySelector('textarea');
textarea.value = "\nwebkit";
textarea.style.display = "";

textarea.focus();
textarea.selectionStart = textarea.selectionEnd = 0;
document.execCommand('insertHTML', false, 'hello\nworld\n');

var expected = 'hello\nworld\n\nwebkit';
if (textarea.value == expected)
    document.getElementById('log').innerText = 'PASS';
else
    document.getElementById('log').innerText = 'FAILED: expected "' + expected + '" but got "' + textarea.value + '"';

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