зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1631967
[wpt PR 23155] - [EventTiming] Add shadow DOM test for first input, a=testonly
Automatic update from web-platform-tests [EventTiming] Add shadow DOM test for first input This CL tests event.target for first-input. The DOM elements do not have event listeners to show that event retargetting correctly retargets to the shadow host. Bug: 543598 Change-Id: Ibd5a4a37a50f79b86d93a5c9c18c8ac7300ba723 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2159622 Reviewed-by: Steve Kobes <skobes@chromium.org> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#761417} -- wpt-commits: 8fe6544d7211fe841ada747897674310973ee429 wpt-pr: 23155
This commit is contained in:
Родитель
43572a7908
Коммит
54a1e68efc
|
@ -0,0 +1,39 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset=utf-8 />
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/testdriver.js></script>
|
||||
<script src=/resources/testdriver-vendor.js></script>
|
||||
|
||||
<body>
|
||||
<div id='container'>
|
||||
<custom-button id='custom_button'></custom-button>
|
||||
</div>
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.');
|
||||
let innerButtonClicked = false;
|
||||
customElements.define('custom-button', class extends HTMLElement {
|
||||
connectedCallback() {
|
||||
this.attachShadow({mode: 'open'});
|
||||
this.shadowRoot.innerHTML = `<button id='inner_button_id'>Click me</button>`;
|
||||
this.shadowRoot.getElementById('inner_button_id').onmousedown = () => {
|
||||
innerButtonClicked = true;
|
||||
};
|
||||
}
|
||||
});
|
||||
const observer = new PerformanceObserver(t.step_func_done(entryList => {
|
||||
// There must only be one first-input entry.
|
||||
assert_equals(entryList.getEntries().length, 1);
|
||||
// entry.target must be the shadow host due to retargetting.
|
||||
assert_equals(entryList.getEntries()[0].target,
|
||||
document.getElementById('custom_button'));
|
||||
assert_true(innerButtonClicked, 'Did not reach the shadow DOM event listener!');
|
||||
}));
|
||||
observer.observe({entryTypes: ['first-input']});
|
||||
test_driver.click(document.getElementById('custom_button'));
|
||||
}, "Event Timing: test first input on shadow DOM.");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче