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: 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..216b06dcd559d63242ba30d6a24c14410d84deae
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/inserting/insert-space.html
@@ -0,0 +1,36 @@
+<!doctype HTML>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<div contenteditable><p id="p1">AB</p></div>
+<div contenteditable><p id="p2"></p></div>
+<script>
+test(function() {
+ var p1 = document.getElementById('p1');
+ var range = document.createRange();
+ var selection = window.getSelection();
+ range.setStart(p1.childNodes[0], 1);
+ range.collapse(true);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ document.execCommand('insertText', false, ' ');
+
+ var html_para = p1.outerHTML;
+ assert_equals(html_para, '<p id="p1">A B</p>');
yosin_UTC9 2016/07/25 07:42:22 Can we use assert_selection()?
joone 2016/07/26 04:16:34 Done.
+}, 'insert a plain space in the middle of text node');
+
+test(function() {
+ var p2 = document.getElementById('p2');
+ p2.appendChild(document.createTextNode('A'));
+ p2.appendChild(document.createTextNode('B'));
+ var range = document.createRange();
+ var selection = window.getSelection();
+ range.setStart(p2.childNodes[0], 1);
+ range.collapse(true);
+ selection.removeAllRanges();
+ selection.addRange(range);
+ document.execCommand('insertText', false, ' ');
+
+ var html_para = p2.outerHTML;
+ assert_equals(html_para, '<p id="p2">A B</p>');
yosin_UTC9 2016/07/25 07:42:22 Can we use assert_selection()?
joone 2016/07/26 04:16:34 Done.
+}, 'insert a plain space between two inserted text nodes');
+</script>

Powered by Google App Engine
This is Rietveld 408576698