Index: third_party/WebKit/LayoutTests/editing/spelling/paste_into_element_starting_with_invisible.html |
diff --git a/third_party/WebKit/LayoutTests/editing/spelling/paste_into_element_starting_with_invisible.html b/third_party/WebKit/LayoutTests/editing/spelling/paste_into_element_starting_with_invisible.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1fa57b228974248323426c9b03668e76efaedfa8 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/spelling/paste_into_element_starting_with_invisible.html |
@@ -0,0 +1,31 @@ |
+<!doctype html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="resources/util.js"></script> |
+ |
+<div id="source"> |
+zz. |
+</div> |
+ |
+<div contenteditable> |
+<span id="target">[]</span> |
+</div> |
+ |
+<script> |
+// Regression test for crbug.com/640456 |
+ |
+function copyAndPaste() { |
+ var source = document.getElementById('source'); |
+ var target = document.getElementById('target'); |
+ var sel = window.getSelection(); |
+ sel.selectAllChildren(source); |
+ document.execCommand('copy'); |
+ sel.collapse(target.firstChild, 1); |
+ document.execCommand('paste'); |
+} |
+ |
+runSpellingTest( |
+ [() => copyAndPaste()], |
+ [() => assert_true(internals.hasSpellingMarker(document, 1, 2))], |
+ 'Spelling markers should appear immediately after pasting.'); |
+</script> |