Chromium Code Reviews| 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..141bcbec90fe0b6c4d00be95257a6e1c4280178d |
| --- /dev/null |
| +++ b/LayoutTests/fast/events/dispatch-synthetic-mouseevent-no-action.html |
| @@ -0,0 +1,35 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<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."); |
| + |
| +function focusHandler() { |
| + testFailed('default action should not occur.'); |
| +} |
| + |
| +function test() |
| +{ |
| + if (window.testRunner) |
| + testRunner.dumpAsText(); |
| + |
| + var node = document.getElementById('top'); |
| + node.addEventListener('focus', focusHandler, false); |
|
Rick Byers
2015/03/05 16:34:18
as an extra sanity check that your test is functio
|
| + var client = node.getBoundingClientRect(); |
| + |
| + var event = document.createEvent("MouseEvents"); |
|
Rick Byers
2015/03/05 16:34:18
nit: might as well use the constructor syntax (new
|
| + event.initMouseEvent("mousedown", true, false, window, |
| + 0, client.left, client.top, client.left, client.top, false, false, false, false, 0, null); |
| + node.dispatchEvent(event); |
| +} |
| + |
| +test(); |
| +</script> |
| +</body> |
| +</html> |