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

Unified Diff: third_party/WebKit/LayoutTests/editing/pasteboard/preserve-trailing-space.html

Issue 2193033004: Restore the collapsed spaces of the text when we copy it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test cases for <div><b><i>foo </i></b> bar</div> Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/editing/pasteboard/preserve-trailing-space.html
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/preserve-trailing-space.html b/third_party/WebKit/LayoutTests/editing/pasteboard/preserve-trailing-space.html
new file mode 100644
index 0000000000000000000000000000000000000000..b4986d9534a78c9e04758a34d19e580ddfbe2c8d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/preserve-trailing-space.html
@@ -0,0 +1,58 @@
+<!doctype HTML>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
+<script>
+test(() => assert_selection(
+ '<div id="copy" style="width: 10em;">^Copy this area <a href="http://foo/">AVeryLongWordThatWillWrap|</a></div><div contenteditable id="editor"></div>',
+ selection => {
+ var copy = selection.document.getElementById('copy');
+ var editor = selection.document.getElementById('editor');
+
+ selection.document.execCommand('copy');
+ selection.collapse(editor);
+ selection.document.execCommand('paste');
+ },
+ '<div id="copy" style="width: 10em;">Copy this area <a href="http://foo/">AVeryLongWordThatWillWrap</a></div><div contenteditable id="editor">Copy this area\u00A0<a href="http://foo/">AVeryLongWordThatWillWrap|</a></div>'),
+ 'insert a plain space between two inserted text nodes');
+
+test(() => assert_selection(
+ '<div><b><i>^foo</i></b> bar|</div><div contenteditable id="editor"></div>',
+ selection => {
+ var copy = selection.document.getElementById('copy');
+ var editor = selection.document.getElementById('editor');
+
+ selection.document.execCommand('copy');
+ selection.collapse(editor);
+ selection.document.execCommand('paste');
+ },
+ '<div><b><i>foo</i></b> bar</div><div contenteditable id="editor"><b><i>foo</i></b>\u00A0bar|</div>'),
+ 'insert a plain space between two inserted text nodes');
+
+test(() => assert_selection(
+ '<div><b><i>^foo </i></b>bar|</div><div contenteditable id="editor"></div>',
+ selection => {
+ var copy = selection.document.getElementById('copy');
+ var editor = selection.document.getElementById('editor');
+
+ selection.document.execCommand('copy');
+ selection.collapse(editor);
+ selection.document.execCommand('paste');
+ },
+ '<div><b><i>foo </i></b>bar</div><div contenteditable id="editor"><b><i>foo\u00A0</i></b>bar|</div>'),
+ 'insert a plain space between two inserted text nodes');
+
+
+test(() => assert_selection(
+ '<div><b><i>^foo </i></b> bar|</div><div contenteditable id="editor"></div>',
+ selection => {
+ var copy = selection.document.getElementById('copy');
+ var editor = selection.document.getElementById('editor');
+
+ selection.document.execCommand('copy');
+ selection.collapse(editor);
+ selection.document.execCommand('paste');
+ },
+ '<div><b><i>foo </i></b> bar</div><div contenteditable id="editor"><b><i>foo\u00A0</i></b>bar|</div>'),
joone 2016/08/03 21:51:00 In this case, only one space is reserved.
+ 'insert a plain space between two inserted text nodes');
+</script>

Powered by Google App Engine
This is Rietveld 408576698