Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / HTMLDialogElement / modal-dialog-distributed-child-is-not-inert.html
blobeba625b8abf55eb7527159d161a2e73ec3c46ec4
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <dialog>
8 <content></content>
9 </dialog>
10 <div id="host">
11 <button>Click me</button>
12 </div>
13 <script>
14 function clickOn(element)
16 if (!window.eventSender)
17 return;
18 var rect = element.getBoundingClientRect();
19 eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2);
20 eventSender.mouseDown();
21 eventSender.mouseUp();
24 jsTestIsAsync = true;
25 description('Tests that nodes transposed into the dialog are not inert. The test passes if you can click the button.');
27 dialog = document.querySelector('dialog');
28 root = document.querySelector('#host').createShadowRoot();
29 root.appendChild(dialog);
30 dialog.showModal();
32 button = document.querySelector('button');
33 dialog.addEventListener('click', function(event) {
34 if (event.target == button)
35 testPassed('button was clicked');
36 else
37 testFailed('button was not clicked');
38 finishJSTest();
39 });
40 clickOn(button);
41 </script>
42 </body>
43 </html>