Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Unified Diff: LayoutTests/fast/events/relative-offset-of-simulated-click.html

Issue 316733004: MouseEvent.offsetX/Y should just return 0,0 for simulated clicks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/relative-offset-of-simulated-click-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/relative-offset-of-simulated-click.html
diff --git a/LayoutTests/fast/events/relative-offset-of-simulated-click.html b/LayoutTests/fast/events/relative-offset-of-simulated-click.html
new file mode 100644
index 0000000000000000000000000000000000000000..8f60afe6df15638446c35e06282be6b325c064cb
--- /dev/null
+++ b/LayoutTests/fast/events/relative-offset-of-simulated-click.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<script>
+description("This test documents the behavior of MouseEvent.offsetX/Y in response to HTMLElement.click().");
+
+var testDiv = document.createElement("div");
+testDiv.setAttribute("style", "background: green; width: 100px; height: 100px; position: absolute; top: 100px; left: 100px;");
+document.body.appendChild(testDiv);
+
+testDiv.addEventListener("click", function(e) {
+ event = e;
+ shouldBe("event.offsetX", expectedX);
+ shouldBe("event.offsetY", expectedY);
+});
+
+debug("Simulated click with .click():");
+expectedX = "0";
+expectedY = "0";
+testDiv.click();
+
+if (!window.eventSender)
+ debug("This part of the test requires eventSender!");
+else {
+ debug("Click with mouse at 0,0:");
+ expectedX = "0";
+ expectedY = "0";
+ eventSender.mouseMoveTo(100, 100);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ debug("Click with mouse at 40,50:");
+ expectedX = "40";
+ expectedY = "50";
+ eventSender.mouseMoveTo(140, 150);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+}
+
+testDiv.remove();
+
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/events/relative-offset-of-simulated-click-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698