Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/textarea/textarea-value-last-eol.html

Issue 1785603002: TEXTAREA: Cutting last line without EOL should not remove the remaining EOL in the previous line. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove an ASSERT, update a comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <body> 2 <body>
3 <script src="../../../resources/testharness.js"></script> 3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script> 4 <script src="../../../resources/testharnessreport.js"></script>
5 <div id="log"></div> 5 <div id="log"></div>
6 <textarea></textarea> 6 <textarea></textarea>
7 <script> 7 <script>
8 test(function() { 8 test(function() {
9 var textarea = document.querySelector('textarea'); 9 var textarea = document.querySelector('textarea');
10 textarea.focus(); 10 textarea.focus();
11 eventSender.keyDown('H'); 11 eventSender.keyDown('H');
12 eventSender.keyDown('\n'); 12 eventSender.keyDown('\n');
13 eventSender.keyDown('W'); 13 eventSender.keyDown('W');
14 assert_equals(textarea.value, 'H\nW'); 14 assert_equals(textarea.value, 'H\nW');
15 textarea.setSelectionRange(2, 3); // "W" 15 textarea.setSelectionRange(2, 3); // "W"
16 document.execCommand('cut'); 16 document.execCommand('cut');
17 assert_equals(textarea.value, 'H\n');
17 textarea.setSelectionRange(0, 0); 18 textarea.setSelectionRange(0, 0);
18 document.execCommand('paste'); 19 document.execCommand('paste');
19 // TODO(tkent): The following assertion fails now. crbug.com/522144.
20 assert_equals(textarea.value, 'WH\n'); 20 assert_equals(textarea.value, 'WH\n');
21 }, 'TEXTAREA should not remove the last EOL on paste.'); 21 }, 'TEXTAREA should not remove the last EOL on paste.');
22
23 test(function() {
24 var textarea1 = document.createElement('textarea');
25 document.body.appendChild(textarea1);
26 textarea1.focus();
27 textarea1.addEventListener('copy', function(event) {
28 event.clipboardData.setData('text', 'foo\n');
29 event.preventDefault();
30 });
31 document.execCommand('copy');
32
33 // Use another TEXAREA. We need a clean one.
34 var textarea2 = document.createElement('textarea');
35 document.body.appendChild(textarea2);
36 textarea2.focus();
37 document.execCommand('paste');
38 assert_equals(textarea2.value, 'foo\n');
39 }, 'Pasting text ending \\n should not add another \\n.');
22 </script> 40 </script>
23 </body> 41 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698