-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generalize some DOM events tests #49211
Open
ptomato
wants to merge
19
commits into
web-platform-tests:master
Choose a base branch
from
ptomato:generalize-dom-events-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Generalize some DOM events tests #49211
ptomato
wants to merge
19
commits into
web-platform-tests:master
from
ptomato:generalize-dom-events-tests
+1,195
−275
Conversation
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
Rename existing test to CustomEvent-createEvent.window.js, and add a version that doesn't depend on document.createEvent() as CustomEvent.any.js.
Rename the original test to Event-cancelBubble-dom.html and keep only the parts that depend on bubbling up through DOM elements in that file. Add a new file, Event-cancelBubble.window.js and move the rest there, to avoid the HTML boilerplate.
Rename existing test to Event-cancelBubble-createEvent.window.js, and add a version that doesn't depend on document.createEvent() as Event-cancelBubble.any.js.
Rename existing test to Event-constants-createEvent.window.js, and add a version that doesn't depend on document.createEvent() as Event-constants.any.js. Also, make sure to expose the export on globalThis in the support script.
…test Rename existing test to Event-defaultPrevented-after-dispatch-createEvent.html, and add a version that doesn't depend on document.createEvent() or DOM elements, as Event-defaultPrevented-after-dispatch.any.js.
Rename existing test to Event-defaultPrevented-createEvent.window.js, and add a version that doesn't depend on document.createEvent() as Event-defaultPrevented.any.js.
Rename the existing test to Event-init-while-dispatching-dom-events.window.js and keep only the tests for the window-specific DOM events in that file. Move the tests for Event and CustomEvent, which are [Exposed=*], to a separate file, named Event-init-while-dispatching.any.js.
Rename existing test to Event-initEvent-createEvent.window.js, and add a version that doesn't depend on document.createEvent() as Event-initEvent.any.js.
Most of this test can be an .any.js test. Keep only the existing test for what happens when Event.returnValue is set in between document.createEvent and initEvent, in a separate file named Event-returnValue-createEvent.window.js.
Rename existing test to Event-stopImmediatePropagation-dom.html, and add a version that uses an EventTarget object instead of a DOM node as Event-stopImmediatePropagation.any.js.
Rename the existing test to Event-subclasses-constructors-dom-events.window.js and keep only the tests for the window-specific DOM events in that file. Move the tests for the event subclass, and copy the tests for Event, which is [Exposed=*], to a separate file, named Event-subclasses-constructors.any.js. We have to keep the Event tests in the original file as well, for parent property information.
Rename existing test to Event-type-empty-createEvent.window.js, and add a version that doesn't depend on document.createEvent() as Event-type-empty.any.js. While we're here, add some assertion messages to the original test because I found them helpful during debugging.
The test using the constructor goes in its own .any.js file. Rename the remaining tests that depend on document.createEvent to Event-type-createEvent.window.js.
Rename existing test to EventTarget-this-of-listener-dom.window.js, and add a version that uses EventTarget instances instead of DOM nodes as EventTarget-this-of-listener.any.js.
Rename existing test to remove-all-listeners-dom.window.js, and add a version that uses EventTarget instances instead of DOM nodes as remove-all-listeners.any.js.
Renames the existing test to Event-propagation-dom-node.window.js, and adds a copy in Event-propagation-EventTarget.any.js that uses a plain EventTarget instance instead of a DOM node. The difference is that EventTarget doesn't have bubbling/capture behaviour, so the expectations after stopPropagation() and cancelBubble=true are different.
Rename existing test to EventListener-handleEvent-dom-node.window.js, and add a version that uses EventTarget instances instead of DOM nodes as EventListener-handleEvent.any.js. While we're here, fix a typo in the original test.
Rename existing test to EventTarget-dispatchEvent-dom.window.js, and add a version that uses EventTarget instances instead of DOM nodes and doesn't test the document.createEvent()-specific stuff, as EventTarget-dispatchEvent.any.js.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See discussion in #41966. A few of these
.html
tests can be converted directly to.any.js
tests. Some can be converted to.window.js
tests to avoid boilerplate even though they usedocument.createEvent()
or dispatch events on DOM nodes.For the latter, also add
.any.js
versions that useEvent
constructors and dispatch evens on plainEventTarget
instances. These tests will also execute in Workers, and after #41966 in ShadowRealms.Probably best reviewed commit by commit if you want the details for how I processed each file.