-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move dblclick disabled event test to separate file
In http://crrev.com/1225838 I added dblclick testing to an interop2023 tracked test, which affected our scores. I am temporarily moving the dblclick testing to a separate file while we wait for interop2023 to end. Change-Id: I838e8e3851261bf1fd627b2406492945f26f3640 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5050435 Reviewed-by: Mustaq Ahmed <mustaq@chromium.org> Commit-Queue: Joey Arhar <jarhar@chromium.org> Cr-Commit-Position: refs/heads/main@{#1228123}
- Loading branch information
1 parent
0173c88
commit d3feabf
Showing
2 changed files
with
76 additions
and
13 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
html/semantics/disabled-elements/disabled-event-dispatch-additional.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<!DOCTYPE html> | ||
<meta name="timeout" content="long"> | ||
<link rel=author href="mailto:jarhar@chromium.org"> | ||
<link rel=help href="https://github.com/whatwg/html/issues/2368"> | ||
<link rel=help href="https://github.com/whatwg/html/issues/5886"> | ||
<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> | ||
<script src="/resources/testdriver-actions.js"></script> | ||
|
||
<!-- This test should be merged with disabled-event-dispatch.tentative.html after interop2023 is over. --> | ||
|
||
<div id=targetparent> | ||
<button disabled> | ||
hello world | ||
<span style="border: 1px solid black">child</span> | ||
</button> | ||
<my-control disabled> | ||
hello world | ||
<span style="border: 1px solid black">child</span> | ||
</my-control> | ||
</div> | ||
|
||
<script> | ||
customElements.define('my-control', class extends HTMLElement { | ||
static get formAssociated() { return true; } | ||
}); | ||
|
||
['dblclick', 'auxclick'].forEach(eventName => { | ||
[true, false].forEach(clickChildElement => { | ||
for (const target of targetparent.children) { | ||
promise_test(async () => { | ||
let parentReceivedEvent = false; | ||
targetparent.addEventListener(eventName, () => parentReceivedEvent = true); | ||
|
||
let targetReceivedEvent = false; | ||
target.addEventListener(eventName, () => targetReceivedEvent = true); | ||
|
||
let childReceivedEvent = false; | ||
let targetchild = target.firstElementChild; | ||
targetchild.addEventListener(eventName, () => childReceivedEvent = true); | ||
|
||
const elementToClick = clickChildElement ? targetchild : target; | ||
if (eventName === 'dblclick') { | ||
await (new test_driver.Actions() | ||
.pointerMove(1, 1, {origin: elementToClick}) | ||
.pointerDown() | ||
.pointerUp() | ||
.pointerDown() | ||
.pointerUp()) | ||
.send(); | ||
} else if (eventName === 'auxclick') { | ||
const actions = new test_driver.Actions(); | ||
await actions | ||
.pointerMove(1, 1, {origin: elementToClick}) | ||
.pointerDown({button: actions.ButtonType.MIDDLE}) | ||
.pointerUp({button: actions.ButtonType.MIDDLE}) | ||
.send(); | ||
} | ||
|
||
|
||
const shouldReceiveEvents = eventName.startsWith('pointer') || eventName === 'auxclick'; | ||
assert_equals(parentReceivedEvent, shouldReceiveEvents, | ||
`parent element received ${eventName} events`); | ||
assert_equals(targetReceivedEvent, shouldReceiveEvents, | ||
`target element received ${eventName} events`); | ||
assert_equals(childReceivedEvent, clickChildElement, | ||
`child element received ${eventName} events`); | ||
}, `Testing ${eventName} events when clicking ${clickChildElement ? 'child of ' : ''}disabled ${target.localName}.`); | ||
} | ||
}); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters