Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug857487.html
blobe9cec16eced110dc0bc146fcd209fce115ef0f5d
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=857487
5 -->
6 <head>
7 <title>Test for Bug 857487</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 <script src="/tests/SimpleTest/EventUtils.js"></script>
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=857487">Mozilla Bug 857487</a>
14 <div id="edit" contenteditable="true">
15 <table id="table" border="1" width="100%">
16 <tbody>
17 <tr>
18 <td>a</td>
19 <td>b</td>
20 <td>c</td>
21 </tr>
22 <tr>
23 <td>d</td>
24 <td id="cell">e</td>
25 <td>f</td>
26 </tr>
27 <tr>
28 <td>g</td>
29 <td>h</td>
30 <td>i</td>
31 </tr>
32 </tbody>
33 </table>
34 </div>
35 <script type="application/javascript">
37 /**
38 * Test for Bug 857487
40 * Tests that removing a table row through nsIHTMLEditor works
43 function getEditor() {
44 const Ci = SpecialPowers.Ci;
45 var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
46 return editingSession.getEditorForWindow(window).QueryInterface(Ci.nsITableEditor);
49 var cell = document.getElementById("cell");
50 cell.focus();
52 // place caret at end of center cell
53 var sel = getSelection();
54 sel.collapse(cell, cell.childNodes.length);
56 var editor = getEditor();
57 editor.deleteTableRow(1);
59 var table = document.getElementById("table");
61 is(table.innerHTML == "\n <tbody>\n <tr>\n <td>a</td>\n <td>b</td>\n <td>c</td>\n </tr>\n \n <tr>\n <td>g</td>\n <td>h</td>\n <td>i</td>\n </tr>\n </tbody>\n ",
62 true, "editor.deleteTableRow(1) should delete the row containing the selection");
64 </script>
67 </body>
68 </html>