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

Unified Diff: third_party/WebKit/LayoutTests/editing/inserting/insert-space-at-start-of-wrapped-line.html

Issue 2618613004: Insert a line break when space is inserted at the top of wrapped lines (Closed)
Patch Set: Fix test on Mac Created 3 years, 11 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698