summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/test_bug599983.xul
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /editor/libeditor/tests/test_bug599983.xul
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'editor/libeditor/tests/test_bug599983.xul')
-rw-r--r--editor/libeditor/tests/test_bug599983.xul70
1 files changed, 70 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_bug599983.xul b/editor/libeditor/tests/test_bug599983.xul
new file mode 100644
index 000000000..8b5d52a8c
--- /dev/null
+++ b/editor/libeditor/tests/test_bug599983.xul
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin"
+ type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=599983
+-->
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="Mozilla Bug 599983" onload="runTest()">
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=599983"
+ target="_blank">Mozilla Bug 599983</a>
+ <editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ id="editor"
+ editortype="html"
+ src="about:blank" />
+ </body>
+ <script type="application/javascript">
+ <![CDATA[
+
+ SimpleTest.waitForExplicitFinish();
+
+ const kAllowInteraction = Components.interfaces.nsIPlaintextEditor
+ .eEditorAllowInteraction;
+ const kMailMask = Components.interfaces.nsIPlaintextEditor.eEditorMailMask;
+
+ function runTest() {
+ testEditor(false, false);
+ testEditor(false, true);
+ testEditor(true, false);
+ testEditor(true, true);
+
+ SimpleTest.finish();
+ }
+
+ function testEditor(setAllowInteraction, setMailMask) {
+ var desc = " with " + (setAllowInteraction ? "" : "no ") +
+ "eEditorAllowInteraction and " +
+ (setMailMask ? "" : "no ") + "eEditorMailMask";
+
+ var editorElem = document.getElementById("editor");
+
+ var editorObj = editorElem.getEditor(editorElem.contentWindow);
+ editorObj.flags = (setAllowInteraction ? kAllowInteraction : 0) |
+ (setMailMask ? kMailMask : 0);
+
+ var editorDoc = editorElem.contentDocument;
+ editorDoc.body.innerHTML = "<p>foo<p>bar";
+ editorDoc.getSelection().selectAllChildren(editorDoc.body.firstChild);
+ editorDoc.execCommand("bold");
+
+ var createsDirty = !setAllowInteraction || setMailMask;
+
+ (createsDirty ? isnot : is)(editorDoc.querySelector("[_moz_dirty]"), null,
+ "Elements with _moz_dirty" + desc);
+
+ // Even if we do create _moz_dirty, we should strip it for innerHTML.
+ is(editorDoc.body.innerHTML, "<p><b>foo</b></p><p>bar</p>",
+ "innerHTML" + desc);
+ }
+
+ ]]>
+ </script>
+</window>