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

Side by Side Diff: LayoutTests/fast/events/mid-button-link-click.html

Issue 23060022: Don't turn middleclicks into click events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed tests that no longer added any value. Created 7 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../js/resources/js-test-pre.js"></script>
3 <body>
4 <a href="#" id=testlink1 style="display:block; width:300px; height:100px">Test content</a>
5 <a href="#"><div id=testlink2 style="width:300px; height:100px">Test content</ div></a>
6 <script>
7 description('Mousedown and mouseup with middle button on link should not result in a click event.');
8 jsTestIsAsync = true;
9 window.onload = function() {
10 testMiddle("testlink1", false);
11 testMiddle("testlink2", true);
12 }
13 function testMiddle(testElmId, finishWhenDone) {
14 var testElm = document.getElementById(testElmId);
15 var mouseDownCount = 0;
16 testElm.addEventListener("mousedown", function(event) {
17 if (event.button != 1) {
18 testFailed("Unexpected mouse button. Use the middle button on the mo use.");
19 return;
20 }
21 mouseDownCount++;
22 if (mouseDownCount == 3 && !seenClick) {
23 testPassed("No unexpected click event seen at " + testElmId + ".")
24 if (finishWhenDone)
25 finishJSTest();
26 }
27 }, false);
28 testElm.addEventListener("mouseup", function(event) {
29 if (event.button != 1) {
30 testFailed("Unexpected mouse button. Use the middle button on the mo use.");
31 return;
32 }
33 }, false);
34 var seenClick = false;
35 testElm.addEventListener("click", function(event) {
36 seenClick = true;
37 testFailed("There was an unexpected click event.");
38 if (event.button != 1) {
39 testFailed("The click event had an even more unexpected button. Use the middle button on the mouse.");
40 }
41 if (finishWhenDone)
42 finishJSTest();
43 }, false);
44 var seenDblClick
45 testElm.addEventListener("dblclick", function(event) {
46 seenDblClick = true;
47 testFailed("There was an unexpected dblclick event at " + testElmId + ". ");
48 if (event.button != 1) {
49 testFailed("The dblclick event had an even more unexpected button. U se the middle button on the mouse.");
50 }
51 if (finishWhenDone)
52 finishJSTest();
53 }, false);
54
55 if ("eventSender" in window) {
56 // Mousedown on the iframe, but no mouseup.
57 eventSender.mouseMoveTo(testElm.offsetLeft + testElm.offsetWidth / 2,
58 testElm.offsetTop + testElm.offsetHeight / 2);
59 // Button 0 (default) is left, 2 is right, everything else is middle.
60 eventSender.mouseDown(1);
61 eventSender.mouseUp(1);
62 eventSender.mouseDown(1);
63 eventSender.mouseUp(1);
64 eventSender.mouseDown(1);
65 eventSender.mouseUp(1);
66 }
67 else {
68 testElm.innerHTML = "window.eventSender not available. To test manually press and release the mouse middle button *twice* on this text.";
69 }
70 }
71 </script>
72 <script src="../js/resources/js-test-post.js"></script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698