OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <p>This tests pasting into a textarea that starts with a line break that didn't
initially have a renderer (display: none). | 4 <p>This tests pasting into a textarea that starts with a line break that didn't
initially have a renderer (display: none). |
5 WebKit should still be able to paste text with line breaks.</p> | 5 WebKit should still be able to paste text with line breaks.</p> |
6 <textarea id="test" style="display: none" cols="50" rows="10"></textarea> | 6 <textarea id="test" style="display: none" cols="50" rows="10"></textarea> |
7 <div id="log"></div> | 7 <div id="log"></div> |
8 <script type="text/javascript"> | 8 <script type="text/javascript"> |
9 | 9 |
10 if (window.layoutTestController) | 10 if (window.layoutTestController) |
11 layoutTestController.dumpAsText(); | 11 layoutTestController.dumpAsText(); |
12 | 12 |
13 var textarea = document.querySelector('textarea'); | 13 var textarea = document.querySelector('textarea'); |
14 textarea.value = "\nwebkit"; | 14 textarea.value = "\nwebkit"; |
15 textarea.style.display = ""; | 15 textarea.style.display = ""; |
16 | 16 |
17 textarea.focus(); | 17 textarea.focus(); |
18 textarea.selectionStart = textarea.selectionEnd = 0; | 18 textarea.selectionStart = textarea.selectionEnd = 0; |
19 document.execCommand('insertHTML', false, 'hello\nworld\n'); | 19 document.execCommand('insertHTML', false, 'hello\nworld\n'); |
20 | 20 |
21 var expected = 'hello\nworld\nwebkit'; | 21 var expected = 'hello\nworld\nwebkit'; |
22 if (textarea.value == expected) | 22 if (textarea.value == expected) |
23 document.getElementById('log').innerText = 'PASS'; | 23 document.getElementById('log').innerText = 'PASS'; |
24 else | 24 else |
25 document.getElementById('log').innerText = 'FAILED: expected "' + expected +
'" but got "' + textarea.value + '"'; | 25 document.getElementById('log').innerText = 'FAILED: expected "' + expected +
'" but got "' + textarea.value + '"'; |
26 | 26 |
27 </script> | 27 </script> |
28 </body> | 28 </body> |
29 </html> | 29 </html> |
OLD | NEW |