test_bug552782.html (1456B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=552782 5 --> 6 <head> 7 <title>Test for Bug 552782</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=290026">Mozilla Bug 552782</a> 14 <p id="display"></p> 15 <div id="editor" contenteditable></div> 16 17 <pre id="test"> 18 <script type="application/javascript"> 19 20 /** Test for Bug 552782 */ 21 SimpleTest.waitForExplicitFinish(); 22 23 var original = "<ol><li>Item 1</li><ol><li>Item 2</li><li>Item 3</li><li>Item 4</li></ol></ol>"; 24 var editor = document.getElementById("editor"); 25 editor.innerHTML = original; 26 editor.focus(); 27 28 addLoadEvent(function() { 29 var sel = window.getSelection(); 30 sel.removeAllRanges(); 31 var lis = document.getElementsByTagName("li"); 32 sel.selectAllChildren(lis[2]); 33 document.execCommand("outdent", false, false); 34 var expected = "<ol><li>Item 1</li><ol><li>Item 2</li></ol><li>Item 3</li><ol><li>Item 4</li></ol></ol>"; 35 is(editor.innerHTML, expected, "outdenting third item in a partially indented numbered list"); 36 document.execCommand("indent", false, false); 37 todo_is(editor.innerHTML, original, "re-indenting third item in a partially indented numbered list"); 38 39 // done 40 SimpleTest.finish(); 41 }); 42 43 </script> 44 </pre> 45 </body> 46 </html>