adele@apple.com | d874c8b | 2008-07-01 02:49:31 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <script> |
| 4 | var mouseDownCount; |
| 5 | var log = function(msg) |
| 6 | { |
| 7 | document.getElementById("console").appendChild(document.createTextNode(msg + "\n")); |
| 8 | } |
| 9 | function test() |
| 10 | { |
| 11 | mouseDownCount = 0; |
| 12 | |
rniwa@webkit.org | ea3cf92 | 2012-06-22 06:52:33 +0000 | [diff] [blame] | 13 | if (window.testRunner) |
| 14 | testRunner.dumpAsText(); |
adele@apple.com | d874c8b | 2008-07-01 02:49:31 +0000 | [diff] [blame] | 15 | |
| 16 | var sf = document.getElementById("search"); |
| 17 | |
| 18 | var buttonX = sf.offsetLeft + sf.offsetWidth - 6; |
| 19 | var middleX = sf.offsetLeft + sf.offsetWidth / 2; |
| 20 | |
| 21 | var y = sf.offsetTop + sf.offsetHeight / 2; |
| 22 | |
rniwa@webkit.org | ea3cf92 | 2012-06-22 06:52:33 +0000 | [diff] [blame] | 23 | if (window.testRunner) { |
adele@apple.com | d874c8b | 2008-07-01 02:49:31 +0000 | [diff] [blame] | 24 | eventSender.mouseMoveTo(buttonX, y); |
| 25 | eventSender.mouseDown(); |
| 26 | eventSender.mouseUp(); |
| 27 | |
| 28 | eventSender.mouseMoveTo(middleX, y); |
| 29 | eventSender.mouseDown(); |
| 30 | eventSender.mouseUp(); |
| 31 | |
| 32 | if (mouseDownCount == 2) |
| 33 | log("Test Passed"); |
| 34 | else |
| 35 | log("Test Failed"); |
| 36 | } |
| 37 | } |
| 38 | </script> |
| 39 | </head> |
| 40 | <body onload="test()"> |
| 41 | This tests that clicking on the hidden cancel button won't start capturing mouse events. To run this test manually, click where the |
| 42 | cancel button would be, and then click in the middle of the field. If you see two "onmousedown" strings logged, then the test passes.<br> |
| 43 | <input type="search" id="search" onmousedown="mouseDownCount++; log('onmousedown')"/> |
| 44 | <pre id="console"></pre> |
| 45 | </body> |
| 46 | </html> |