editor/libeditor/html/tests/test_bug456244.html

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:0279689b5b45
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>
7
8 <script class="testbody" type="application/javascript">
9 function runTest() {
10
11 function select(id) {
12 var e = document.getElementById(id);
13 e.focus();
14 return e;
15 }
16
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 }
25
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 }
35
36 test_end_bs(select("t1"));
37 test_end_bs(setupIframe('i1',0));
38
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 }
49
50 SimpleTest.finish();
51 }
52
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>
60
61 <pre id="test">
62 </pre>
63
64 <div> <span id="t1" style="border:1px solid blue" contenteditable="true">X</span> Y</div>
65
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>
68
69 </body>
70 </html>

mercurial