| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <dialog> |
| <content></content> |
| </dialog> |
| <div id="host"> |
| <button>Click me</button> |
| </div> |
| <script> |
| function clickOn(element) |
| { |
| if (!window.eventSender) |
| return; |
| var rect = element.getBoundingClientRect(); |
| eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| } |
| |
| jsTestIsAsync = true; |
| description('Tests that nodes transposed into the dialog are not inert. The test passes if you can click the button.'); |
| |
| dialog = document.querySelector('dialog'); |
| root = document.querySelector('#host').createShadowRoot(); |
| root.appendChild(dialog); |
| dialog.showModal(); |
| |
| button = document.querySelector('button'); |
| dialog.addEventListener('click', function(event) { |
| if (event.target == button) |
| testPassed('button was clicked'); |
| else |
| testFailed('button was not clicked'); |
| finishJSTest(); |
| }); |
| clickOn(button); |
| </script> |
| </body> |
| </html> |