Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / HTMLDialogElement / closed-dialog-does-not-block-mouse-events.html
blob0b7ad1c9d19d081d63e979b46e6c0598e9b43c82
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 #div {
6 height: 100px;
7 width: 100px;
8 background: red;
10 </style>
11 <script src="../../../resources/js-test.js"></script>
12 </head>
13 <body>
14 <div id="div"></div>
15 <dialog id="dialog"></dialog>
16 <dialog></dialog>
17 <script>
18 description('Test for bug 110952. Ensure that closed dialogs do not block mouse events. To test manually, click the red box. The test succeeds if the red box turns green.');
20 function clickOn(element)
22 if (!window.eventSender)
23 return;
25 var absoluteTop = 0;
26 var absoluteLeft = 0;
27 for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) {
28 absoluteLeft += parentNode.offsetLeft;
29 absoluteTop += parentNode.offsetTop;
32 var x = absoluteLeft + element.offsetWidth / 2;
33 var y = absoluteTop + element.offsetHeight / 2;
34 eventSender.mouseMoveTo(x, y);
35 eventSender.mouseDown();
36 eventSender.mouseUp()
37 eventSender.mouseMoveTo(0, 0);
40 if (window.testRunner)
41 testRunner.dumpAsText();
43 dialog = document.getElementById('dialog');
44 dialog.showModal();
45 dialog.close();
47 div = document.getElementById('div');
48 div.addEventListener('click', function(event) {
49 div.firedOn = true;
50 div.style.backgroundColor = 'green';
51 });
53 clickOn(div);
55 shouldBeTrue('div.firedOn');
56 </script>
57 </body>
58 </html>