Index: third_party/WebKit/LayoutTests/editing/inserting/insert_paragraph_separator.html |
diff --git a/third_party/WebKit/LayoutTests/editing/inserting/insert_paragraph_separator.html b/third_party/WebKit/LayoutTests/editing/inserting/insert_paragraph_separator.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6bb06e368573b34945b3de7cb7fbc70b025ec78c |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/inserting/insert_paragraph_separator.html |
@@ -0,0 +1,33 @@ |
+<!doctype html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="../assert_selection.js"></script> |
+<div id="log"></div> |
+<script> |
+test(() => assert_selection( |
+ '<div contenteditable>foo<br><div>|bar</div></div>', |
+ 'insertParagraph', |
+ '<div contenteditable>foo<br><div><br></div><div>|bar</div></div>'), |
+ 'insert a paragraph separator after BR and before character'); |
+ |
+test(() => assert_selection( |
+ '<div contenteditable>foo<div>|bar</div></div>', |
+ 'insertParagraph', |
+ '<div contenteditable>foo<div><br></div><div>|bar</div></div>'), |
+ 'insert a paragraph separator before character'); |
+ |
+// A Test for a bug in the paragraph separator insertion code that would add an |
+// extra newline when inserting a paragraph separator at the end of a paragraph |
+// in text that preserves newlines. Also, an extraneous space would be added |
+// after 'foo'. Only one newline should be added. And there should be no |
+// extraneous spaces. |
+// |
+// It demonstrates a bug: too much padding is left between the new line and the |
+// end of the paragraph containing 'foo'. |
+test(() => assert_selection( |
+ '<div contenteditable><pre>foo\n|bar</pre></div>', |
+ 'insertParagraph', |
+ '<div contenteditable><pre>foo\n<br></pre><pre>|bar</pre></div>'), |
+ 'insert a paragraph separator in PRE'); |
+</script> |
+ |