summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/test_join_split_node_direction_change_command.html
diff options
context:
space:
mode:
Diffstat (limited to 'editor/libeditor/tests/test_join_split_node_direction_change_command.html')
-rw-r--r--editor/libeditor/tests/test_join_split_node_direction_change_command.html57
1 files changed, 57 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_join_split_node_direction_change_command.html b/editor/libeditor/tests/test_join_split_node_direction_change_command.html
new file mode 100644
index 0000000000..a68396b700
--- /dev/null
+++ b/editor/libeditor/tests/test_join_split_node_direction_change_command.html
@@ -0,0 +1,57 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
+<script>
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(async () => {
+ let iframe = document.querySelector("iframe");
+ async function resetIframe() {
+ iframe?.remove();
+ iframe = document.createElement("iframe");
+ document.body.appendChild(iframe);
+ iframe.srcdoc = "<body></body>";
+ if (iframe.contentDocument?.readyState != "complete") {
+ await new Promise(resolve => iframe.addEventListener("load", resolve, {once: true}));
+ }
+ iframe.contentWindow.focus();
+ }
+
+ await resetIframe();
+ iframe.contentDocument.body.innerHTML = "<div contenteditable><br></div>";
+ ok(
+ iframe.contentDocument.queryCommandSupported("enableCompatibleJoinSplitDirection"),
+ "command should be supported"
+ );
+ ok(
+ iframe.contentDocument.queryCommandEnabled("enableCompatibleJoinSplitDirection"),
+ "command should be enabled"
+ );
+ ok(
+ iframe.contentDocument.queryCommandState("enableCompatibleJoinSplitDirection"),
+ "command state should be true"
+ );
+ is(
+ iframe.contentDocument.queryCommandValue("enableCompatibleJoinSplitDirection"),
+ "",
+ "command value should be empty string"
+ );
+ ok(
+ !iframe.contentDocument.execCommand("enableCompatibleJoinSplitDirection", false, "false"),
+ "command to disable it should return false"
+ );
+ ok(
+ iframe.contentDocument.queryCommandState("enableCompatibleJoinSplitDirection"),
+ "command state should be true even after executing the command to disable it"
+ );
+
+ SimpleTest.finish();
+});
+</script>
+</head>
+<body></body>
+</html>