Bug 1328023 - Part 2. Add test for undo. r=masayuki, a=jcristau
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 30 Jan 2017 17:27:26 +0900
changeset 378066 46497fa848f7b678b5d1bbfd28ed8d1828443b9b
parent 378065 e235e56f062a8bb2bfec3ea17fa098ecd422b476
child 378067 c76aa324c7c2b57ce42a8b26c48778782b41be76
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki, jcristau
bugs1328023
milestone53.0a2
Bug 1328023 - Part 2. Add test for undo. r=masayuki, a=jcristau MozReview-Commit-ID: 6ZuluRWrYxb
editor/libeditor/tests/mochitest.ini
editor/libeditor/tests/test_bug1328023.html
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -211,16 +211,17 @@ skip-if = toolkit == 'android'
 [test_bug1248185.html]
 [test_bug1258085.html]
 [test_bug1268736.html]
 [test_bug1310912.html]
 skip-if = toolkit == 'android' # bug 1315898
 [test_bug1314790.html]
 [test_bug1315065.html]
 [test_bug1316302.html]
+[test_bug1328023.html]
 [test_bug1330796.html]
 [test_bug1332876.html]
 
 [test_CF_HTML_clipboard.html]
 subsuite = clipboard
 [test_composition_event_created_in_chrome.html]
 [test_contenteditable_focus.html]
 [test_dom_input_event_on_htmleditor.html]
new file mode 100644
--- /dev/null
+++ b/editor/libeditor/tests/test_bug1328023.html
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1328023
+-->
+<html>
+<head>
+  <title>Test for Bug 1328023</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <script type="application/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=1328023">Mozilla Bug 1328023</a>
+<p id="display"></p>
+<div id="content" style="display: none;">
+
+</div>
+
+<input type="text" id="input1"/>
+<pre id="test">
+
+<script class="testbody" type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(function() {
+  let elm = document.getElementById("input1");
+
+  elm.focus();
+  synthesizeKey("A", {});
+  synthesizeKey("B", {});
+  is(elm.value, "AB", "AB is input.value now");
+
+  synthesizeKey("VK_BACK_SPACE", {});
+  is(elm.value, "A", "A is input.value now");
+
+  synthesizeKey("Z", { accelKey: true });
+  is(elm.value, "AB", "AB is input.value now");
+
+  synthesizeKey("C", {});
+  is(elm.value, "ABC", "ABC is input.value now");
+
+  synthesizeKey("VK_BACK_SPACE", {});
+  synthesizeKey("VK_BACK_SPACE", {});
+  synthesizeKey("VK_BACK_SPACE", {});
+
+  synthesizeKey("A", {});
+  synthesizeKey("B", {});
+  synthesizeKey("C", {});
+  is(elm.value, "ABC", "ABC is input.value now");
+
+  synthesizeKey("Z", { accelKey: true });
+  is(elm.value, "", "'' is input.value now");
+
+  synthesizeKey("Z", { accelKey: true, shiftKey: true });
+  is(elm.value, "ABC", "ABC is input.value now");
+
+  synthesizeKey("D", {});
+  is(elm.value, "ABCD", "ABCD is input.value now");
+
+  SimpleTest.finish();
+});
+</script>
+</pre>
+</body>
+</html>