summaryrefslogtreecommitdiffstats
path: root/dom/events/test/test_bug1339758.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/events/test/test_bug1339758.html
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/events/test/test_bug1339758.html')
-rw-r--r--dom/events/test/test_bug1339758.html80
1 files changed, 80 insertions, 0 deletions
diff --git a/dom/events/test/test_bug1339758.html b/dom/events/test/test_bug1339758.html
new file mode 100644
index 0000000000..0a437f57de
--- /dev/null
+++ b/dom/events/test/test_bug1339758.html
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1339758
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1339758</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+
+ /** Test for Bug 1339758 **/
+ var expectNonZeroCoordinates = false;
+ SimpleTest.waitForExplicitFinish();
+
+ function testCoordinates(e) {
+ var coordinateProperties =
+ [ "screenX",
+ "screenY",
+ "clientX",
+ "clientY",
+ "offsetX",
+ "offsetY",
+ "movementX",
+ "movementY",
+ "layerX",
+ "layerY",
+ "x",
+ "y" ];
+ for (var i in coordinateProperties) {
+ if (e[coordinateProperties[i]] != 0) {
+ ok(expectNonZeroCoordinates, e.target.id + " got at least some non-zero coordinate property: " + i);
+ return;
+ }
+ }
+ ok(!expectNonZeroCoordinates, "Non-zero coordinates weren't expected");
+ }
+
+ function runTests() {
+ info("Testing click events which should have only 0 coordinates.");
+ document.getElementById("div_target").click();
+ document.getElementById("a_target").focus();
+ sendKey("RETURN");
+ document.getElementById("input_target").focus();
+ sendKey("RETURN");
+
+ info("Testing click events which should have also non-zero coordinates.");
+ expectNonZeroCoordinates = true;
+ // Test script created MouseEvents
+ sendMouseEvent({ type: "click"}, document.getElementById("a_target"));
+ sendMouseEvent({ type: "click"}, document.getElementById("input_target"));
+
+ // Test widget level mouse events
+ synthesizeMouse(document.getElementById("a_target"), 2, 2, {});
+ synthesizeMouse(document.getElementById("input_target"), 2, 2, {});
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForFocus(runTests);
+
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1339758">Mozilla Bug 1339758</a>
+<p id="display"></p>
+
+<div id="div_target" onclick="testCoordinates(event)">&nbsp;</div>
+<a href="#" id="a_target" onclick="testCoordinates(event);">test link</a><br>
+<input type="button" id="input_target" onclick="testCoordinates(event);" value="test button">
+
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>