Bug 1776680 [wpt PR 34603] - [@container] Test invalidation of font-relative units...
[gecko.git] / dom / events / test / test_bug1339758.html
blob0a437f57de9b801ae50567fb79970610d8caf4c4
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1339758
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 1339758</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <script src="/tests/SimpleTest/EventUtils.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 <script type="application/javascript">
14 /** Test for Bug 1339758 **/
15 var expectNonZeroCoordinates = false;
16 SimpleTest.waitForExplicitFinish();
18 function testCoordinates(e) {
19 var coordinateProperties =
20 [ "screenX",
21 "screenY",
22 "clientX",
23 "clientY",
24 "offsetX",
25 "offsetY",
26 "movementX",
27 "movementY",
28 "layerX",
29 "layerY",
30 "x",
31 "y" ];
32 for (var i in coordinateProperties) {
33 if (e[coordinateProperties[i]] != 0) {
34 ok(expectNonZeroCoordinates, e.target.id + " got at least some non-zero coordinate property: " + i);
35 return;
38 ok(!expectNonZeroCoordinates, "Non-zero coordinates weren't expected");
41 function runTests() {
42 info("Testing click events which should have only 0 coordinates.");
43 document.getElementById("div_target").click();
44 document.getElementById("a_target").focus();
45 sendKey("RETURN");
46 document.getElementById("input_target").focus();
47 sendKey("RETURN");
49 info("Testing click events which should have also non-zero coordinates.");
50 expectNonZeroCoordinates = true;
51 // Test script created MouseEvents
52 sendMouseEvent({ type: "click"}, document.getElementById("a_target"));
53 sendMouseEvent({ type: "click"}, document.getElementById("input_target"));
55 // Test widget level mouse events
56 synthesizeMouse(document.getElementById("a_target"), 2, 2, {});
57 synthesizeMouse(document.getElementById("input_target"), 2, 2, {});
58 SimpleTest.finish();
61 SimpleTest.waitForFocus(runTests);
64 </script>
65 </head>
66 <body>
67 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1339758">Mozilla Bug 1339758</a>
68 <p id="display"></p>
70 <div id="div_target" onclick="testCoordinates(event)">&nbsp;</div>
71 <a href="#" id="a_target" onclick="testCoordinates(event);">test link</a><br>
72 <input type="button" id="input_target" onclick="testCoordinates(event);" value="test button">
74 <div id="content" style="display: none">
76 </div>
77 <pre id="test">
78 </pre>
79 </body>
80 </html>