Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype HTML> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <div contenteditable><p id="p1">AB</p></div> | |
| 5 <div contenteditable><p id="p2"></p></div> | |
| 6 <script> | |
| 7 test(function() { | |
| 8 var p1 = document.getElementById('p1'); | |
| 9 var range = document.createRange(); | |
| 10 var selection = window.getSelection(); | |
| 11 range.setStart(p1.childNodes[0], 1); | |
| 12 range.collapse(true); | |
| 13 selection.removeAllRanges(); | |
| 14 selection.addRange(range); | |
| 15 document.execCommand('insertText', false, ' '); | |
| 16 | |
| 17 var html_para = p1.outerHTML; | |
| 18 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.
| |
| 19 }, 'insert a plain space in the middle of text node'); | |
| 20 | |
| 21 test(function() { | |
| 22 var p2 = document.getElementById('p2'); | |
| 23 p2.appendChild(document.createTextNode('A')); | |
| 24 p2.appendChild(document.createTextNode('B')); | |
| 25 var range = document.createRange(); | |
| 26 var selection = window.getSelection(); | |
| 27 range.setStart(p2.childNodes[0], 1); | |
| 28 range.collapse(true); | |
| 29 selection.removeAllRanges(); | |
| 30 selection.addRange(range); | |
| 31 document.execCommand('insertText', false, ' '); | |
| 32 | |
| 33 var html_para = p2.outerHTML; | |
| 34 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.
| |
| 35 }, 'insert a plain space between two inserted text nodes'); | |
| 36 </script> | |
| OLD | NEW |