summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/test_inlineTableEditing.html
diff options
context:
space:
mode:
Diffstat (limited to 'editor/libeditor/tests/test_inlineTableEditing.html')
-rw-r--r--editor/libeditor/tests/test_inlineTableEditing.html62
1 files changed, 62 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_inlineTableEditing.html b/editor/libeditor/tests/test_inlineTableEditing.html
new file mode 100644
index 0000000000..411b5f6510
--- /dev/null
+++ b/editor/libeditor/tests/test_inlineTableEditing.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<div contenteditable></div>
+<pre id="test">
+
+<script class="testbody" type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(function() {
+ const editableInnerHTML =
+`<table>
+ <tr><td>ABCDEFG</td><td>HIJKLMN</td></tr>
+ <tr><td>ABCDEFG</td><td>HIJKLMN</td></tr>
+ <tr><td>ABCDEFG</td><td>HIJKLMN</td></tr>
+</table>`;
+
+ document.execCommand("enableObjectResizing", false, "false");
+ document.execCommand("enableInlineTableEditing", false, "true");
+
+ function doTest(aDescription, aTable) {
+ synthesizeMouseAtCenter(aTable, {});
+ isnot(
+ aTable.getAttribute("_moz_resizing"),
+ "true",
+ `${aDescription}: _moz_resizing attribute shouldn't be true without object resizing`
+ );
+
+ const tr2 = aTable.querySelector("tr + tr");
+ synthesizeMouse(tr2, 0, tr2.clientHeight / 2, {});
+ ok(
+ !tr2.isConnected,
+ `${aDescription}: The second <tr> element should've been removed by a click`
+ );
+ }
+
+ const editingHost = document.querySelector("div[contenteditable]");
+ editingHost.innerHTML = editableInnerHTML;
+ doTest("Testing in Light DOM", editingHost.querySelector("table"));
+
+ editingHost.remove();
+
+ const shadowHost = document.createElement("div");
+ document.body.insertBefore(shadowHost, document.body.firstChild);
+ const shadowRoot = shadowHost.attachShadow({mode: "open"});
+ shadowRoot.appendChild(document.createElement("div"));
+ shadowRoot.firstChild.setAttribute("contenteditable", "");
+ shadowRoot.firstChild.innerHTML = editableInnerHTML;
+ doTest("Testing in Shadow DOM", shadowRoot.firstChild.querySelector("table"));
+
+ shadowHost.remove();
+
+ SimpleTest.finish();
+});
+</script>
+</pre>
+</body>
+</html>