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

Unified Diff: LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html

Issue 894913002: Prevent default actions for JS-generated mouse events other than click (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: changed failing tests to use eventsender Created 5 years, 8 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
Index: LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html
diff --git a/LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html b/LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html
new file mode 100644
index 0000000000000000000000000000000000000000..18392ed04147314473fb82bea7fed3b78723c021
--- /dev/null
+++ b/LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
Rick Byers 2015/06/10 21:56:57 nit: omit html, head, body tags: https://www.chrom
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<select id='top'></select>
+<pre id="console"></pre>
+<script>
+description("Tests to ensure that default action does not occur.");
Rick Byers 2015/06/10 21:56:57 nit: add "for synthetic mouse events".
+
+function focusHandler() {
+ testFailed('default action should not occur.');
+}
+
+function mousedownHandler() {
+ debug('mousedown event is fired.');
+}
+
+function test()
+{
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ var node = document.getElementById('top');
+ node.addEventListener('focus', focusHandler, false);
+ node.addEventListener('mousedown', mousedownHandler, false);
+ var client = node.getBoundingClientRect();
+
+ var event = new MouseEvent('mousedown', { button: 1 });
+ node.dispatchEvent(event);
+}
+
+test();
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698