OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <body> | 3 <body> |
4 <textarea cols=50 rows=10>first | 4 <textarea cols=50 rows=10>first |
5 second</textarea> | 5 second</textarea> |
6 <script src="../../fast/js/resources/js-test-pre.js"></script> | 6 <script src="../../resources/js-test.js"></script> |
7 <p id="console"></p> | 7 <p id="console"></p> |
8 <script> | 8 <script> |
9 | 9 |
10 if (window.testRunner) | 10 if (window.testRunner) |
11 testRunner.dumpAsText(); | 11 testRunner.dumpAsText(); |
12 | 12 |
13 var textarea = document.querySelector('textarea'); | 13 var textarea = document.querySelector('textarea'); |
14 | 14 |
15 function selectFirstLineIncludingLineBreak() { | 15 function selectFirstLineIncludingLineBreak() { |
16 textarea.focus(); | 16 textarea.focus(); |
17 textarea.setSelectionRange(0, 0); | 17 textarea.setSelectionRange(0, 0); |
18 getSelection().modify('extend', 'forward', 'line'); | 18 getSelection().modify('extend', 'forward', 'line'); |
19 } | 19 } |
20 | 20 |
21 function copyPaste() { | 21 function copyPaste() { |
22 document.execCommand('copy'); | 22 document.execCommand('copy'); |
23 document.execCommand('paste'); | 23 document.execCommand('paste'); |
24 } | 24 } |
25 | 25 |
26 var offsetAfterLineBreak = 6; | 26 var offsetAfterLineBreak = 6; |
27 shouldBe("selectFirstLineIncludingLineBreak(); copyPaste(); textarea.selectionEn
d", "offsetAfterLineBreak"); | 27 shouldBe("selectFirstLineIncludingLineBreak(); copyPaste(); textarea.selectionEn
d", "offsetAfterLineBreak"); |
28 | 28 |
29 </script> | 29 </script> |
30 </body> | 30 </body> |
31 </html> | 31 </html> |
OLD | NEW |