editor/libeditor/html/tests/test_bug552782.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/html/tests/test_bug552782.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,47 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=552782
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 552782</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=290026">Mozilla Bug 552782</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="editor" contenteditable></div>
    1.19 +
    1.20 +<pre id="test">
    1.21 +<script type="application/javascript">
    1.22 +
    1.23 +/** Test for Bug 552782 **/
    1.24 +SimpleTest.waitForExplicitFinish();
    1.25 +
    1.26 +var original = '<ol><li>Item 1</li><ol><li>Item 2</li><li>Item 3</li><li>Item 4</li></ol></ol>';
    1.27 +var editor = document.getElementById("editor");
    1.28 +editor.innerHTML = original;
    1.29 +editor.focus();
    1.30 +
    1.31 +addLoadEvent(function() {
    1.32 +
    1.33 +  var sel = window.getSelection();
    1.34 +  sel.removeAllRanges();
    1.35 +  var lis = document.getElementsByTagName("li");
    1.36 +  sel.selectAllChildren(lis[2]);
    1.37 +  document.execCommand("outdent", false, false);
    1.38 +  var expected = '<ol><li>Item 1</li><ol><li>Item 2</li></ol><li>Item 3</li><ol><li>Item 4</li></ol></ol>';
    1.39 +  is(editor.innerHTML, expected, "outdenting third item in a partially indented numbered list");
    1.40 +  document.execCommand("indent", false, false);
    1.41 +  todo_is(editor.innerHTML, original, "re-indenting third item in a partially indented numbered list");
    1.42 +
    1.43 +  // done
    1.44 +  SimpleTest.finish();
    1.45 +});
    1.46 +
    1.47 +</script>
    1.48 +</pre>
    1.49 +</body>
    1.50 +</html>

mercurial