Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug1268736.html
blobbd0265aaf3117f8bc3e3a76ddce0d3b3ec83ee24
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1268736
5 -->
6 <head>
7 <title>Test for Bug 1268736</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=1268736">Mozilla Bug 1268736</a>
14 <table id="table" border="1" width="100%">
15 <tbody>
16 <tr>
17 <td>a</td>
18 <td>b</td>
19 <td>c</td>
20 </tr>
21 <tr>
22 <td>d</td>
23 <td id="cell_readonly">e</td>
24 <td contenteditable="true" id="cell_writable">f</td>
25 </tr>
26 </tbody>
27 </table>
29 <script type="application/javascript">
31 /**
32 * Test for Bug 1268736
34 * Tests for editing a table cell's contents when the table cell is or isn't a child of a contenteditable node.
38 function getEditor() {
39 const Ci = SpecialPowers.Ci;
40 var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
41 return editingSession.getEditorForWindow(window).QueryInterface(Ci.nsITableEditor);
44 var table = document.getElementById("table");
45 var tableHTML = table.innerHTML;
46 var editor = getEditor();
48 var cell = document.getElementById("cell_readonly");
49 cell.focus();
50 editor.deleteTableCellContents();
51 is(table.innerHTML == tableHTML, true, "editor should not modify non-editable table cell" );
53 cell = document.getElementById("cell_writable");
54 cell.focus();
55 editor.deleteTableCellContents();
56 is(cell.innerHTML == "<br>", true, "editor can modify editable table cells" );
58 </script>
59 </body>
60 </html>