Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / option-mouseevents.html
blob118505a3dd25446ebc6c49ec2e4ca5220c1b8699
1 <html>
2 <head>
3 <script>
4 function print(message, color) {
5 var paragraph = document.createElement("div");
6 paragraph.appendChild(document.createTextNode(message));
7 paragraph.style.fontFamily = "monospace";
8 if (color)
9 paragraph.style.color = color;
10 document.getElementById("console").appendChild(paragraph);
12 function shouldBe(description, actual, expected)
14 if (expected === actual) {
15 print("PASS: " + description + " should be " + expected +
16 " and is\n",
17 "green");
18 } else {
19 print("FAIL: " + description + " should be " + expected +
20 " but instead is " + actual + "\n",
21 "red");
24 function mouseeventverify(event, x, y, offsetX, offsetY, target, type)
26 shouldBe("event type", event.type, type);
27 shouldBe("event target", event.target, target);
28 shouldBe("event.pageX", event.pageX, x);
29 shouldBe("event.pageY", event.pageY, y);
30 shouldBe("event.offsetX", event.offsetX, offsetX);
31 shouldBe("event.offsetY", event.offsetY, offsetY);
32 shouldBe("event.x", event.x, x);
33 shouldBe("event.y", event.y, y);
35 function test() {
36 if (window.testRunner) {
37 testRunner.dumpAsText();
38 testRunner.waitUntilDone();
41 if (window.eventSender) {
42 eventSender.mouseMoveTo(22, 104);
43 eventSender.mouseDown();
44 eventSender.mouseUp();
47 if (window.eventSender) {
48 eventSender.mouseMoveTo(22, 184);
49 eventSender.mouseDown();
50 eventSender.mouseUp();
53 if (window.eventSender) {
54 eventSender.mouseMoveTo(22, 262);
55 eventSender.mouseDown();
56 eventSender.mouseUp();
59 if (window.eventSender) {
60 eventSender.mouseMoveTo(22, 344);
61 eventSender.mouseDown();
62 eventSender.mouseUp();
63 eventSender.mouseDown();
64 eventSender.mouseUp();
67 if (window.eventSender) {
68 eventSender.mouseMoveTo(22, 448);
69 eventSender.mouseDown();
70 eventSender.mouseUp();
71 eventSender.mouseDown();
72 eventSender.mouseUp();
75 if (window.testRunner)
76 testRunner.notifyDone();
78 </script>
79 </head>
80 <body onload="test();">
81 <p>This page tests whether a click event on a list box item propogates with the correct target and positioning values.<br>
82 Bug 3248: Mouse events on OPTION element seem to be ignored<br>
83 <a href="https://bugs.webkit.org/show_bug.cgi?id=3248">https://bugs.webkit.org/show_bug.cgi?id=3248</a></p>
84 <form action="" method="post">
85 <select style="position:absolute; top: 84;" size="2" onmousedown="mouseeventverify(event, 22, 104, 13, 5, document.getElementById('o1'), 'mousedown')">
86 <option>One
87 <option id="o1" onmousedown="mouseeventverify(event, 22, 104, 13, 5, this, 'mousedown')">Two
88 </select>
89 </form>
90 <form action="" method="post">
91 <select style="position:absolute; top: 164;" size="2" onmouseup="mouseeventverify(event, 22, 184, 13, 5, document.getElementById('o2'), 'mouseup')">
92 <option>One
93 <option id="o2" onmouseup="mouseeventverify(event, 22, 184, 13, 5, this, 'mouseup')">Two
94 </select>
95 </form>
96 <form action="" method="post">
97 <select style="position:absolute; top: 242;" size="2" onclick="mouseeventverify(event, 22, 262, 13, 5, document.getElementById('o3'), 'click')">
98 <option>One
99 <option id="o3" onclick="mouseeventverify(event, 22, 262, 13, 5, this, 'click')">Two
100 </select>
101 </form>
102 <form action="" method="post">
103 <select style="position:absolute; top: 324;" size="2" ondblclick="mouseeventverify(event, 22, 344, 13, 5, document.getElementById('o4'), 'dblclick')">
104 <option>One
105 <option id="o4" ondblclick="mouseeventverify(event, 22, 344, 13, 5, this, 'dblclick')">Two
106 </select>
107 </form>
108 <select style="position:absolute; top: 408;" size="3" onmousedown="mouseeventverify(event, 22, 448, 12, 38, this, 'mousedown')">
109 <option>One
110 <option id="o5" onmousedown="mouseeventverify(event, 22, 448, 12, 38, this, 'mousedown')">Two
111 </select>
112 </form>
113 <div style="position:absolute; top: 550;" id='console'></div>
114 </body>
115 </html>