summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/test_bug1094000.html
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_bug1094000.html
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_bug1094000.html')
-rw-r--r--editor/libeditor/tests/test_bug1094000.html104
1 files changed, 104 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_bug1094000.html b/editor/libeditor/tests/test_bug1094000.html
new file mode 100644
index 000000000..cc27cc675
--- /dev/null
+++ b/editor/libeditor/tests/test_bug1094000.html
@@ -0,0 +1,104 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1094000
+-->
+<head>
+ <title>Test for Bug 1094000</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1094000">Mozilla Bug 1094000</a>
+<p id="display"></p>
+<div id="content">
+ <div id="editor0" contenteditable></div>
+ <div id="editor1" contenteditable><br></div>
+ <div id="editor2" contenteditable>a</div>
+ <div id="editor3" contenteditable>b</div>
+ <div id="editor4" contenteditable>c</div>
+ <div id="editor5" contenteditable>d</div>
+ <div id="editor6" contenteditable>e</div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 1094000 **/
+
+SimpleTest.waitForExplicitFinish();
+
+const kIsLinux = navigator.platform.indexOf("Linux") == 0;
+
+function runTests()
+{
+ var editor0 = document.getElementById("editor0");
+ var editor1 = document.getElementById("editor1");
+ var editor2 = document.getElementById("editor2");
+ var editor3 = document.getElementById("editor3");
+ var editor4 = document.getElementById("editor4");
+ var editor5 = document.getElementById("editor5");
+ var editor6 = document.getElementById("editor6");
+
+ ok(editor1.getBoundingClientRect().height - editor0.getBoundingClientRect().height > 1,
+ "an editor having a <br> element and an empty editor shouldn't be same height");
+ ok(Math.abs(editor1.getBoundingClientRect().height - editor2.getBoundingClientRect().height) <= 1,
+ "an editor having only a <br> element and an editor having \"a\" should be same height");
+
+ editor2.focus();
+ synthesizeKey("VK_RIGHT", {});
+ synthesizeKey("VK_BACK_SPACE", {});
+ is(editor2.innerHTML, "<br>",
+ "an editor which had \"a\" should have only <br> element after Backspace keypress");
+ ok(Math.abs(editor2.getBoundingClientRect().height - editor1.getBoundingClientRect().height) <= 1,
+ "an editor whose content was removed by Backspace key should have a place to put a caret");
+
+ editor3.focus();
+ synthesizeKey("VK_LEFT", {});
+ synthesizeKey("VK_DELETE", {});
+ is(editor3.innerHTML, "<br>",
+ "an editor which had \"b\" should have only <br> element after Delete keypress");
+ ok(Math.abs(editor3.getBoundingClientRect().height - editor1.getBoundingClientRect().height) <= 1,
+ "an editor whose content was removed by Delete key should have a place to put a caret");
+
+ editor4.focus();
+ window.getSelection().selectAllChildren(editor4);
+ synthesizeKey("VK_BACK_SPACE", {});
+ is(editor4.innerHTML, "<br>",
+ "an editor which had \"c\" should have only <br> element after removing selected text with Backspace key");
+ ok(Math.abs(editor4.getBoundingClientRect().height - editor1.getBoundingClientRect().height) <= 1,
+ "an editor whose content was selected and removed by Backspace key should have a place to put a caret");
+
+ editor5.focus();
+ window.getSelection().selectAllChildren(editor5);
+ synthesizeKey("VK_DELETE", {});
+ is(editor5.innerHTML, "<br>",
+ "an editor which had \"d\" should have only <br> element after removing selected text with Delete key");
+ ok(Math.abs(editor5.getBoundingClientRect().height - editor1.getBoundingClientRect().height) <= 1,
+ "an editor whose content was selected and removed by Delete key should have a place to put a caret");
+
+ editor6.focus();
+ window.getSelection().selectAllChildren(editor6);
+ synthesizeKey("x", { accelKey: true });
+ is(editor6.innerHTML, "<br>",
+ "an editor which had \"e\" should have only <br> element after removing selected text by \"Cut\"");
+ ok(Math.abs(editor6.getBoundingClientRect().height - editor1.getBoundingClientRect().height) <= 1,
+ "an editor whose content was selected and removed by \"Cut\" should have a place to put a caret");
+
+ editor0.focus();
+ synthesizeKey("VK_BACK_SPACE", {});
+ is(editor0.innerHTML, "",
+ "an empty editor should keep being empty even if Backspace key is pressed");
+ synthesizeKey("VK_DELETE", {});
+ is(editor0.innerHTML, "",
+ "an empty editor should keep being empty even if Delete key is pressed");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForFocus(runTests);
+
+</script>
+</pre>
+</body>
+</html>