Index: third_party/WebKit/LayoutTests/editing/inserting/insert-space-at-start-of-wrapped-line.html |
diff --git a/third_party/WebKit/LayoutTests/editing/inserting/insert-space-at-start-of-wrapped-line.html b/third_party/WebKit/LayoutTests/editing/inserting/insert-space-at-start-of-wrapped-line.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9defdf2967ec3c89f125d0bc6d51ddd85bf2ae17 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/editing/inserting/insert-space-at-start-of-wrapped-line.html |
@@ -0,0 +1,50 @@ |
+<!doctype HTML> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<style> |
+#textarea, #plaintext, #richedit { |
+ font-family: 'Courier', monospace; |
+ width: 10ch; |
+} |
+#plaintext, #richedit { |
+ border: 1px solid black; |
+ white-space: pre-wrap; |
+} |
+</style> |
+<textarea id="textarea">12345 67</textarea> |
+<div id="plaintext" contenteditable="plaintext-only">12345 67</div> |
+<div id="richedit" contenteditable>12345 67</div> |
+<script> |
+(function () { |
+ if (!window.eventSender) { |
yosin_UTC9
2017/01/06 01:22:22
Good pattern!
|
+ test(function () { |
+ assert_unreached(); |
+ }, 'This test requires eventSender'); |
+ return; |
+ } |
+ |
+ test(function () { |
+ let textarea = document.getElementById('textarea'); |
+ textarea.focus(); |
+ textarea.setSelectionRange(10, 10); |
+ eventSender.keyDown(' '); |
+ assert_equals(textarea.value, '12345 \n 67', 'Line break should be inserted automatically'); |
+ }, 'Typing space at the start of wrapped line in textarea'); |
+ |
+ test(function () { |
+ let editor = document.getElementById('plaintext'); |
+ let textNode = editor.firstChild; |
+ window.getSelection().setBaseAndExtent(textNode, 10, textNode, 10); |
+ eventSender.keyDown(' '); |
+ assert_equals(editor.textContent, '12345 \n 67', 'Line break should be inserted automatically'); |
+ }, 'Typing space at the start of wrapped line in plaintext-only'); |
+ |
+ test(function () { |
+ let editor = document.getElementById('richedit'); |
+ let textNode = editor.firstChild; |
+ window.getSelection().setBaseAndExtent(textNode, 10, textNode, 10); |
+ eventSender.keyDown(' '); |
+ assert_equals(editor.textContent, '12345 67', 'Line break should NOT be inserted automatically'); |
+ }, 'Typing space at the start of wrapped line in contenteditable'); |
+})(); |
+</script> |