| Nicolás Peña Moreno | bc01db7 | 2020-04-18 00:14:01 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <meta charset=utf-8 /> |
| 4 | <script src=/resources/testharness.js></script> |
| 5 | <script src=/resources/testharnessreport.js></script> |
| 6 | <script src=/resources/testdriver.js></script> |
| 7 | <script src=/resources/testdriver-vendor.js></script> |
| 8 | |
| 9 | <script src=resources/event-timing-test-utils.js></script> |
| 10 | |
| 11 | <custom-button id='custom_button'></custom-button> |
| 12 | |
| 13 | <script> |
| 14 | async_test(function(t) { |
| 15 | assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.'); |
| 16 | let innerButtonClicked = false; |
| 17 | customElements.define('custom-button', class extends HTMLElement { |
| 18 | connectedCallback() { |
| 19 | this.attachShadow({mode: 'open'}); |
| 20 | this.shadowRoot.innerHTML = `<button id='inner_button_id'>Click me</button>`; |
| 21 | this.shadowRoot.getElementById('inner_button_id').onclick = () => { |
| 22 | innerButtonClicked = true; |
| 23 | }; |
| 24 | } |
| 25 | }); |
| 26 | const observer = new PerformanceObserver(t.step_func_done((entryList) => { |
| 27 | const entries = entryList.getEntries().filter(e => e.name === 'mousedown'); |
| 28 | // There must only be one click entry. |
| 29 | assert_equals(entries.length, 1); |
| 30 | verifyClickEvent(entries[0], 'custom_button', true); |
| 31 | assert_true(innerButtonClicked); |
| 32 | })); |
| 33 | observer.observe({entryTypes: ['event']}); |
| 34 | clickAndBlockMain('custom_button'); |
| 35 | }, "Event Timing: target reports the last Event Target, i.e. nothing from shadow DOM."); |
| 36 | </script> |
| 37 | </html> |