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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/textarea/textarea-paste-newline.html

Issue 1809033002: Pasting \n into an empty TEXTAREA should set the caret after the \n. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script> 2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script> 3 <script src="../../../resources/testharnessreport.js"></script>
4 <div id="log"></div> 4 <div id="log"></div>
5 <textarea id="ta"></textarea> 5 <textarea id="ta"></textarea>
6 <script> 6 <script>
7 test(function() { 7 test(function() {
8 var ta = document.getElementById("ta"); 8 var ta = document.getElementById("ta");
9 ta.value = "abc\n"; 9 ta.value = "abc\n";
10 ta.focus(); 10 ta.focus();
11 ta.setSelectionRange(0, 4); 11 ta.setSelectionRange(0, 4);
12 document.execCommand("cut"); 12 document.execCommand("cut");
13 document.execCommand("paste"); 13 document.execCommand("paste");
14 assert_equals(ta.value, "abc\n"); 14 assert_equals(ta.value, "abc\n");
15 15
16 ta.setSelectionRange(0, 0); 16 ta.setSelectionRange(0, 0);
17 document.execCommand("paste"); 17 document.execCommand("paste");
18 assert_equals(ta.value, "abc\nabc\n"); 18 assert_equals(ta.value, "abc\nabc\n");
19 }, "Pasting text ending with newline should work correctly."); 19 }, "Pasting text ending with newline should work correctly.");
20
21 test(function() {
22 var source = document.createElement("textarea");
23 document.body.appendChild(source);
24 source.value = "\n";
25 source.focus();
26 source.select();
27 document.execCommand("copy");
28
29 var dest = document.createElement("textarea");
30 document.body.appendChild(dest);
31 dest.focus();
32 document.execCommand("paste");
33 assert_equals(dest.value, "\n");
34 assert_equals(dest.selectionStart, 1);
35 assert_equals(dest.selectionEnd, 1);
36 }, "Pasting \\n into an empty TEXTAREA should set the caret at the end.");
20 </script> 37 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698