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

Unified Diff: third_party/WebKit/LayoutTests/editing/inserting/insert-space.html

Issue 2175163004: Add a plain space instead of   between text nodes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use of assert_selection() and introduce |shouldEmitNBSPbeforeEnd| Created 4 years, 5 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
Index: third_party/WebKit/LayoutTests/editing/inserting/insert-space.html
diff --git a/third_party/WebKit/LayoutTests/editing/inserting/insert-space.html b/third_party/WebKit/LayoutTests/editing/inserting/insert-space.html
new file mode 100644
index 0000000000000000000000000000000000000000..aaf2af7ad60a7d6a3ca84146ec3ce34ca7f57598
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/inserting/insert-space.html
@@ -0,0 +1,29 @@
+<!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 contenteditable><p>A|B</p></div>',
+ 'insertText \ ',
+ '<div contenteditable><p>A |B</p></div>'),
+ 'insert a plain space in the middle of text node');
+
+test(() => assert_selection(
+ '<div contenteditable><p id="para"></p></div>',
+ selection => {
+ var para = selection.document.getElementById('para');
+ para.appendChild(selection.document.createTextNode('A'));
+ para.appendChild(selection.document.createTextNode('B'));
+
+ var range = selection.document.createRange();
+ range.setStart(para.childNodes[0], 1);
+ range.collapse(true);
+ selection.removeAllRanges();
+ selection.addRange(range);
yosin_UTC9 2016/07/26 04:49:12 We don't need to use |Range|. We could write: sele
+
+ selection.document.execCommand('insertText', false, ' ');
+ },
+ '<div contenteditable><p id="para">A |B</p></div>'),
+ 'insert a plain space between two inserted text nodes');
+</script>

Powered by Google App Engine
This is Rietveld 408576698