| OLD | NEW |
| 1 <html> | 1 <!doctype html> |
| 2 <body> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <div> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 This tests indenting "three" then undoing the indent. You should see one, two an
d three numbered 1 through 3 then four as a sublist with number 1. | 4 <script src="../assert_selection.js"></script> |
| 5 <p> | 5 <div id="log"></div> |
| 6 <a href="https://bugs.webkit.org/show_bug.cgi?id=28722">Bugzilla bug</a> | 6 <script> |
| 7 <br> | 7 test(() => { |
| 8 <a href="rdar://problem/7169206">Radar bug</a> | 8 assert_selection( |
| 9 </p> | 9 '<ol contenteditable><li>one</li><li>two</li><li>^three|</li><ol><li>fou
r</li></ol></ol>', |
| 10 <ol id="e" contenteditable="true"> | 10 selection => { |
| 11 <li>one</li> | 11 selection.document.execCommand('Indent'); |
| 12 <li>two</li> | 12 selection.document.execCommand('Undo'); |
| 13 <li id="test">three</li> | 13 }, |
| 14 <ol><li>four</li></ol> | 14 '<ol contenteditable><li>one</li><li>two</li><li>^three|</li><ol><li>fou
r</li></ol></ol>'); |
| 15 </ol> | |
| 16 </div> | |
| 17 | 15 |
| 18 <ul> | 16 assert_selection( |
| 19 <li>Before indent:<span id="c1"></span></li> | 17 '<ol contenteditable><li>one</li><li>two</li><li>^three|</li><ol><li>fou
r</li></ol></ol>', |
| 20 <li>After indent:<span id="c2"></span></li> | 18 selection => { |
| 21 <li>After undoing:<span id="c3"></span></li> | 19 selection.document.execCommand('Indent'); |
| 22 </ul> | 20 selection.document.querySelector('ol').contentEditable = false; |
| 23 | 21 selection.document.execCommand('Undo'); |
| 24 <script type="text/javascript"> | 22 }, |
| 25 | 23 '<ol contenteditable=\"false\"><li>one</li><li>two</li><ol><li>^three|</
li><li>four</li></ol></ol>', |
| 26 if (window.testRunner) { | 24 'Undo does nothing for uneditable'); |
| 27 testRunner.dumpEditingCallbacks(); | 25 }); |
| 28 testRunner.dumpAsText(); | |
| 29 } | |
| 30 | |
| 31 var e = document.getElementById('e'); | |
| 32 | |
| 33 document.getElementById('c1').appendChild(document.createTextNode(e.innerHTML)); | |
| 34 | |
| 35 var s = window.getSelection(); | |
| 36 var r = document.createRange(); | |
| 37 r.selectNode(document.getElementById('test')); | |
| 38 s.removeAllRanges(); | |
| 39 s.addRange(r); | |
| 40 document.execCommand("Indent", false, ""); | |
| 41 document.getElementById('c2').appendChild(document.createTextNode(e.innerHTML)); | |
| 42 | |
| 43 document.execCommand("Undo"); | |
| 44 document.getElementById('c3').appendChild(document.createTextNode(e.innerHTML)); | |
| 45 | |
| 46 if (document.getElementById('c1').innerHTML == document.getElementById('c3').inn
erHTML) | |
| 47 document.write("The test passed"); | |
| 48 else | |
| 49 document.write("The test failed."); | |
| 50 </script> | 26 </script> |
| OLD | NEW |