Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug290026.html
blob786a12018cb020ed77daea1f1723ce5bdd431de6
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=290026
5 -->
6 <head>
7 <title>Test for Bug 290026</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 290026</a>
14 <p id="display"></p>
15 <div id="editor" contenteditable></div>
17 <pre id="test">
18 <script type="application/javascript">
20 /** Test for Bug 290026 **/
21 SimpleTest.waitForExplicitFinish();
23 var editor = document.getElementById("editor");
24 editor.innerHTML = "<p></p><ul><li>Item 1</li><li>Item 2</li></ul><p></p>";
25 editor.focus();
27 addLoadEvent(function() {
28 document.execCommand("stylewithcss", false, "true");
29 var sel = window.getSelection();
30 sel.removeAllRanges();
31 var lis = document.getElementsByTagName("li");
32 var range = document.createRange();
33 range.setStart(lis[0], 0);
34 range.setEnd(lis[1], lis[1].childNodes.length);
35 sel.addRange(range);
36 document.execCommand("indent", false, false);
37 var oneindent = '<p></p><ul style="margin-left: 40px;"><li>Item 1</li><li>Item 2</li></ul><p></p>';
38 is(editor.innerHTML, oneindent, "a once indented bulleted list");
39 document.execCommand("indent", false, false);
40 var twoindent = '<p></p><ul style="margin-left: 80px;"><li>Item 1</li><li>Item 2</li></ul><p></p>';
41 is(editor.innerHTML, twoindent, "a twice indented bulleted list");
42 document.execCommand("outdent", false, false);
43 is(editor.innerHTML, oneindent, "outdenting a twice indented bulleted list");
45 // done
46 SimpleTest.finish();
47 });
49 </script>
50 </pre>
51 </body>
52 </html>