summaryrefslogtreecommitdiffstats
path: root/dom/html/test/test_bug1089326.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/html/test/test_bug1089326.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 '')
-rw-r--r--dom/html/test/test_bug1089326.html108
1 files changed, 108 insertions, 0 deletions
diff --git a/dom/html/test/test_bug1089326.html b/dom/html/test/test_bug1089326.html
new file mode 100644
index 0000000000..06f3a7c44d
--- /dev/null
+++ b/dom/html/test/test_bug1089326.html
@@ -0,0 +1,108 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1089326
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1089326</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 1089326 **/
+ function test() {
+ var b = document.getElementById("button");
+ var b_rect = b.getBoundingClientRect();
+ var a = document.getElementById("anchor");
+ var a_rect = a.getBoundingClientRect();
+
+ is(document.elementFromPoint(b_rect.x + 1, b_rect.y + 1), b,
+ "Should find button when doing hit test on top of it.");
+ is(document.elementFromPoint(a_rect.x + 1, a_rect.y + 1), a,
+ "Should find anchor when doing hit test on top of it.");
+
+ var expectedTarget;
+ var clickCount = 0;
+ var container = document.getElementById("interactiveContentContainer");
+ container.addEventListener("click", function(event) {
+ is(event.target, expectedTarget, "Got expected click event target.");
+ ++clickCount;
+ }, true);
+ var i1 = document.getElementById("interactiveContent1");
+ var s11 = document.getElementById("s11");
+ var s12 = document.getElementById("s12");
+
+ var i2 = document.getElementById("interactiveContent2");
+ var s21 = document.getElementById("s21");
+
+ expectedTarget = i1;
+ synthesizeMouseAtCenter(s11, { type: "mousedown" });
+ synthesizeMouseAtCenter(s12, { type: "mouseup" });
+ is(clickCount, 1, "Should have got a click event.");
+
+ expectedTarget = null;
+ synthesizeMouseAtCenter(s11, { type: "mousedown" });
+ synthesizeMouseAtCenter(s21, { type: "mouseup" });
+ is(clickCount, 1, "Should not have got a click event.");
+
+ expectedTarget = null;
+ synthesizeMouseAtCenter(s21, { type: "mousedown" });
+ synthesizeMouseAtCenter(s11, { type: "mouseup" });
+ is(clickCount, 1, "Should not have got a click event.");
+
+ var span1 = document.getElementById("span1");
+ var span2 = document.getElementById("span2");
+ expectedTarget = container;
+ synthesizeMouseAtCenter(span1, { type: "mousedown" });
+ synthesizeMouseAtCenter(span2, { type: "mouseup" });
+ is(clickCount, 2, "Should not have got a click event.");
+
+ button.addEventListener("click", function(event) {
+ is(event.target, expectedTarget, "Got expected click event target.");
+ ++clickCount;
+ }, true);
+
+ expectedTarget = a;
+ synthesizeMouseAtCenter(a, { type: "mousedown" });
+ synthesizeMouseAtCenter(a, { type: "mouseup" });
+ is(clickCount, 3, "Should have got a click event.");
+
+ expectedTarget = a;
+ synthesizeMouseAtCenter(b, { type: "mousedown" });
+ synthesizeMouseAtCenter(b, { type: "mouseup" });
+ is(clickCount, 4, "Should have got a click event.");
+
+ SimpleTest.finish();
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.waitForFocus(test);
+
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1089326">Mozilla Bug 1089326</a>
+<p id="display"></p>
+<button id="button">button <a id="anchor" href="#">anchor</a>button</button>
+
+<div id="interactiveContentContainer">
+ <a id="interactiveContent1" href="#">foo <span id="s11">s11</span><span id="s12">s12</span> bar</a>
+ <a id="interactiveContent2" href="#">foo <span id="s21">s21</span><span id="s22">s22</span> bar</a>
+
+ <div>
+ <span>
+ <span id="span1">span1</span>
+ </span>
+ </div>
+
+ <div>
+ <span>
+ <span id="span2">span2</span>
+ </span>
+ </div>
+</div>
+
+</body>
+</html>