diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /dom/events/test/test_bug1339758.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-37a0381f8351b370577b65028ba1f6563ae23fdf.tar.xz firefox-esr-37a0381f8351b370577b65028ba1f6563ae23fdf.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
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.html | 80 |
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)"> </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> |