Index: third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy-test.html |
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy-test.html b/third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy-test.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a46a589f7c3d603f2a625f045d6a039f378b615f |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/restore-collapsed-space-for-copy-test.html |
@@ -0,0 +1,27 @@ |
+<!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 style="width: 2em;"><b><i>foo</i></b> bar</div><div contenteditable>|</div>', |
+ selection => { |
+ selection.setClipboardData('<b><i>foo</i></b> bar'); |
+ selection.document.execCommand('paste'); |
+ }, |
+ '<div style="width: 2em;"><b><i>foo</i></b> bar</div><div contenteditable><b><i>foo</i></b> bar|</div>'), |
+ '1. Restore the collapsed leading space'); |
+ |
+test(() => assert_selection( |
+ '<div style="width: 2em;">^<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 style="width: 2em;"><b><i>foo</i></b> bar</div><div contenteditable id="editor"><b><i>foo</i></b>\u00A0bar|</div>'), |
+ '2. Restore the collapsed leading space'); |
+</script> |