editor/libeditor/html/tests/test_bug456244.html

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 <!DOCTYPE HTML>
     2 <html><head>
     3 <title>Test for bug 456244</title>
     4 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     5 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     6 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
     8 <script class="testbody" type="application/javascript">
     9 function runTest() {
    11   function select(id) {
    12     var e = document.getElementById(id);
    13     e.focus();
    14     return e;
    15   }
    17   function setupIframe(id) {
    18     var e = document.getElementById(id);
    19     var doc = e.contentDocument;
    20     doc.body.innerHTML = String.fromCharCode(10)+'<span id="' + id + '_span" style="border:1px solid blue" contenteditable="true">X</span>'+String.fromCharCode(10);
    21     e = doc.getElementById(id + "_span");
    22     e.focus();
    23     return e;
    24   }
    26   function test_end_bs(e) {
    27     const msg = "Deleting all text in contenteditable inline element";
    28     var before = e.parentNode.childNodes[0].nodeValue;
    29     sendKey("right");
    30     sendKey("back_space");
    31     sendKey("back_space");
    32     is(e.parentNode.childNodes[0].nodeValue, before, msg + " with id=" + e.id);
    33     is(e.innerHTML, "", msg + " with id=" + e.id);
    34   }
    36   test_end_bs(select("t1"));
    37   test_end_bs(setupIframe('i1',0));
    39   {
    40     const msg = "Deleting all text in contenteditable body element";
    41     var e = document.getElementById('i2');
    42     var doc = e.contentDocument;
    43     doc.body.setAttribute("contenteditable", "true");
    44     doc.body.focus();
    45     sendKey("right");
    46     sendKey("back_space");
    47     is(doc.body.innerHTML, "<br>", msg + " with id=" + e.id);
    48   }
    50   SimpleTest.finish();
    51 }
    53 SimpleTest.waitForExplicitFinish();
    54 addLoadEvent(runTest);
    55 </script>
    56 </head>
    57 <body>
    58 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=456244">Mozilla Bug 456244</a>
    59 <p id="display"></p>
    61 <pre id="test">
    62 </pre>
    64 <div> <span id="t1" style="border:1px solid blue" contenteditable="true">X</span> Y</div>
    66 <iframe id="i1" width="200" height="100" src="about:blank"></iframe><br>
    67 <iframe id="i2" width="200" height="100" src="about:blank">X</iframe><br>
    69 </body>
    70 </html>

mercurial