summaryrefslogtreecommitdiffstats
path: root/dom/events/test/test_bug547996-2.xhtml
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 /dom/events/test/test_bug547996-2.xhtml
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 'dom/events/test/test_bug547996-2.xhtml')
-rw-r--r--dom/events/test/test_bug547996-2.xhtml125
1 files changed, 125 insertions, 0 deletions
diff --git a/dom/events/test/test_bug547996-2.xhtml b/dom/events/test/test_bug547996-2.xhtml
new file mode 100644
index 000000000..52ee9a06e
--- /dev/null
+++ b/dom/events/test/test_bug547996-2.xhtml
@@ -0,0 +1,125 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=547996
+-->
+<head>
+ <title>Test for Bug 547996</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=547996">Mozilla Bug 547996</a>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test">
+<script type="application/javascript"><![CDATA[
+
+/** Test for Bug 547996 **/
+/* mouseEvent.mozInputSource attribute */
+
+var expectedInputSource = null;
+
+function check(event) {
+ is(event.mozInputSource, expectedInputSource, ".mozInputSource");
+}
+
+function doTest() {
+ setup();
+
+ expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_KEYBOARD;
+ testKeyboard();
+
+ expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
+ testMouse();
+
+ expectedInputSource = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_UNKNOWN;
+ testScriptedClicks();
+
+ cleanup();
+ SimpleTest.finish();
+}
+
+function testKeyboard() {
+
+ $("inputTarget").focus();
+ synthesizeKey("VK_SPACE", {});
+ synthesizeKey("VK_RETURN", {});
+
+ $("buttonTarget").focus();
+ synthesizeKey("VK_SPACE", {});
+ synthesizeKey("VK_RETURN", {});
+
+ //XUL buttons do not generate click on ENTER or SPACE,
+ //they do only on accessKey
+
+ $("anchorTarget").focus();
+ synthesizeKey("VK_RETURN", {});
+
+ synthesizeKey("VK_TAB", {});
+ synthesizeKey("VK_SPACE", {});
+ synthesizeKey("VK_RIGHT", {});
+
+ $("checkboxTarget").focus();
+ synthesizeKey("VK_SPACE", {});
+
+ var accessKeyDetails = (navigator.platform.indexOf("Mac") >= 0) ?
+ { ctrlKey : true } : { altKey : true, shiftKey: true };
+
+ synthesizeKey("o", accessKeyDetails);
+ synthesizeKey("t", accessKeyDetails);
+}
+
+function testMouse() {
+ synthesizeMouse($("inputTarget"), 0, 0, {});
+ synthesizeMouse($("buttonTarget"), 0, 0, {});
+ synthesizeMouse($("xulButtonTarget"), 0, 0, {});
+ synthesizeMouse($("anchorTarget"), 0, 0, {});
+ synthesizeMouse($("radioTarget1"), 0, 0, {});
+ synthesizeMouse($("radioTarget2"), 0, 0, {});
+ synthesizeMouse($("checkboxTarget"), 0, 0, {});
+}
+
+function testScriptedClicks() {
+ $("inputTarget").click();
+ $("buttonTarget").click();
+ $("xulButtonTarget").click();
+}
+
+function setup() {
+ $("inputTarget").addEventListener("click", check, false);
+ $("buttonTarget").addEventListener("click", check, false);
+ $("anchorTarget").addEventListener("click", check, false);
+ $("xulButtonTarget").addEventListener("click", check, false);
+ $("radioTarget1").addEventListener("click", check, false);
+ $("radioTarget2").addEventListener("click", check, false);
+ $("checkboxTarget").addEventListener("click", check, false);
+
+}
+
+function cleanup() {
+ $("inputTarget").removeEventListener("click", check, false);
+ $("buttonTarget").removeEventListener("click", check, false);
+ $("xulButtonTarget").removeEventListener("click", check, false);
+ $("anchorTarget").removeEventListener("click", check, false);
+ $("radioTarget1").removeEventListener("click", check, false);
+ $("radioTarget2").removeEventListener("click", check, false);
+ $("checkboxTarget").removeEventListener("click", check, false);
+}
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(doTest, window);
+
+]]></script>
+</pre>
+<input type="checkbox" id="checkboxTarget">Checkbox target</input>
+<input id="inputTarget" type="button" value="HTML Input" accesskey="o"/>
+<button id="buttonTarget">HTML Button</button>
+<xul:button id="xulButtonTarget" accesskey="t">XUL Button</xul:button>
+<a href="#" id="anchorTarget">Anchor</a>
+<input type="radio" id="radioTarget1" name="group">Radio Target 1</input>
+<input type="radio" id="radioTarget2" name="group">Radio Target 2</input>
+</body>
+</html>