REGRESSION(r180726): Removing an empty line at the end of textarea clears the entire...
[WebKit-https.git] / LayoutTests / editing / deleting / delete-empty-line-breaks-at-end-of-textarea.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <textarea cols=5 rows=5>
5 hello
6
7 </textarea>
8 <script src="../../resources/js-test-pre.js"></script>
9 <script>
10
11 description('This tests removing empty lines at the end of an textarea.');
12
13 var textarea = document.querySelector('textarea');
14 evalAndLog('textarea.focus();');
15 evalAndLog('textarea.selectionStart = textarea.selectionEnd = textarea.value.length');
16 shouldBe('textarea.value' ,'"hello\\n\\n"');
17 shouldBe('textarea.selectionStart' ,'7');
18 shouldBe('textarea.selectionEnd' ,'7');
19
20 shouldBe('document.execCommand("delete", false, null); textarea.value', '"hello\\n"');
21 shouldBe('textarea.selectionStart', '6');
22 shouldBe('textarea.selectionEnd', '6');
23
24 shouldBe('document.execCommand("delete", false, null); textarea.value', '"hello"');
25 shouldBe('textarea.selectionStart', '5');
26 shouldBe('textarea.selectionEnd', '5');
27
28 textarea.style.display = 'none';
29
30 var successfullyParsed = true;
31
32 </script>
33 <script src="../../resources/js-test-post.js"></script>
34 </body>
35 </html>