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