diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-21 11:44:51 +0000 |
commit | 9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /editor/libeditor/tests/test_bug408231.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'editor/libeditor/tests/test_bug408231.html')
-rw-r--r-- | editor/libeditor/tests/test_bug408231.html | 233 |
1 files changed, 233 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_bug408231.html b/editor/libeditor/tests/test_bug408231.html new file mode 100644 index 0000000000..517b20619a --- /dev/null +++ b/editor/libeditor/tests/test_bug408231.html @@ -0,0 +1,233 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=408231 +--> +<head> + <title>Test for Bug 408231</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> +</head> +<body style="font-family: serif"> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=408231">Mozilla Bug 408231</a> +<p id="display"></p> +<div id="content" style="display: none"> + +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> + +/** Test for Bug 408231 **/ + + var commandEnabledResults = [ + ["copy", "false"], + ["createlink", "true"], + ["cut", "false"], + ["delete", "true"], + ["fontname", "true"], + ["fontsize", "true"], + ["formatblock", "true"], + ["hilitecolor", "true"], + ["indent", "true"], + ["inserthorizontalrule", "true"], + ["inserthtml", "true"], + ["insertimage", "true"], + ["insertorderedlist", "true"], + ["insertunorderedlist", "true"], + ["insertparagraph", "true"], + ["italic", "true"], + ["justifycenter", "true"], + ["justifyfull", "true"], + ["justifyleft", "true"], + ["justifyright", "true"], + ["outdent", "true"], + ["paste", "false"], + ["redo", "false"], + ["removeformat", "true"], + ["selectall", "true"], + ["strikethrough", "true"], + ["styleWithCSS", "true"], + ["subscript", "true"], + ["superscript", "true"], + ["underline", "true"], + ["undo", "false"], + ["unlink", "true"], + ["not-a-command", "false"], + ]; + + var commandIndetermResults = [ + ["copy", "false"], + ["createlink", "false"], + ["cut", "false"], + ["delete", "false"], + ["fontname", "false"], + ["fontsize", "false"], + ["formatblock", "false"], + ["hilitecolor", "false"], + ["indent", "false"], + ["inserthorizontalrule", "false"], + ["inserthtml", "false"], + ["insertimage", "false"], + ["insertorderedlist", "false"], + ["insertunorderedlist", "false"], + ["insertparagraph", "false"], + ["italic", "false"], + ["justifycenter", "false"], + ["justifyfull", "false"], + ["justifyleft", "false"], + ["justifyright", "false"], + ["outdent", "false"], + // ["paste", "false"], + ["redo", "false"], + ["removeformat", "false"], + ["selectall", "false"], + ["strikethrough", "false"], + ["styleWithCSS", "false"], + ["subscript", "false"], + ["superscript", "false"], + ["underline", "false"], + ["undo", "false"], + ["unlink", "false"], + ["not-a-command", "false"], + ]; + + var commandStateResults = [ + ["copy", "false"], + ["createlink", "false"], + ["cut", "false"], + ["delete", "false"], + ["fontname", "false"], + ["fontsize", "false"], + ["formatblock", "false"], + ["hilitecolor", "false"], + ["indent", "false"], + ["inserthorizontalrule", "false"], + ["inserthtml", "false"], + ["insertimage", "false"], + ["insertorderedlist", "false"], + ["insertunorderedlist", "false"], + ["insertparagraph", "false"], + ["italic", "false"], + ["justifycenter", "false"], + ["justifyfull", "false"], + ["justifyleft", "true"], + ["justifyright", "false"], + ["outdent", "false"], + // ["paste", "false"], + ["redo", "false"], + ["removeformat", "false"], + ["selectall", "false"], + ["strikethrough", "false"], + ["styleWithCSS", "false"], + ["subscript", "false"], + ["superscript", "false"], + ["underline", "false"], + ["undo", "false"], + ["unlink", "false"], + ["not-a-command", "false"], + ]; + + var commandValueResults = [ + ["copy", ""], + ["createlink", ""], + ["cut", ""], + ["delete", ""], + ["fontname", "serif"], + ["fontsize", ""], + ["formatblock", ""], + ["hilitecolor", "transparent"], + ["indent", ""], + ["inserthorizontalrule", ""], + ["inserthtml", ""], + ["insertimage", ""], + ["insertorderedlist", ""], + ["insertunorderedlist", ""], + ["insertparagraph", ""], + ["italic", ""], + ["justifycenter", "left"], + ["justifyfull", "left"], + ["justifyleft", "left"], + ["justifyright", "left"], + ["outdent", ""], + // ["paste", ""], + ["redo", ""], + ["removeformat", ""], + ["selectall", ""], + ["strikethrough", ""], + ["styleWithCSS", ""], + ["subscript", ""], + ["superscript", ""], + ["underline", ""], + ["undo", ""], + ["unlink", ""], + ["not-a-command", ""], + ]; + + + function callQueryCommandEnabled(cmdName) { + var result; + try { + result = "" + document.queryCommandEnabled(cmdName); + } catch (error) { + result = "name" in error ? error.name : "exception"; + } + return result; + } + + function callQueryCommandIndeterm(cmdName) { + var result; + try { + result = "" + document.queryCommandIndeterm(cmdName); + } catch (error) { + result = "name" in error ? error.name : "exception"; + } + return result; + } + + function callQueryCommandState(cmdName) { + var result; + try { + result = "" + document.queryCommandState(cmdName); + } catch (error) { + result = "name" in error ? error.name : "exception"; + } + return result; + } + + function callQueryCommandValue(cmdName) { + var result; + try { + result = "" + document.queryCommandValue(cmdName); + } catch (error) { + result = "name" in error ? error.name : "exception"; + } + return result; + } + + function testQueryCommand(expectedResults, fun, funName) { + for (let i = 0; i < expectedResults.length; i++) { + var commandName = expectedResults[i][0]; + var expectedResult = expectedResults[i][1]; + var result = fun(commandName); + ok(result == expectedResult, funName + "(" + commandName + ") result=" + result + " expected=" + expectedResult); + } + } + + function runTests() { + document.designMode = "on"; + window.getSelection().collapse(document.body, 0); + testQueryCommand(commandEnabledResults, callQueryCommandEnabled, "queryCommandEnabled"); + testQueryCommand(commandIndetermResults, callQueryCommandIndeterm, "queryCommandIndeterm"); + testQueryCommand(commandStateResults, callQueryCommandState, "queryCommandState"); + testQueryCommand(commandValueResults, callQueryCommandValue, "queryCommandValue"); + document.designMode = "off"; + SimpleTest.finish(); + } + + window.onload = runTests; + SimpleTest.waitForExplicitFinish(); + +</script> +</pre> +</body> +</html> |