Skip to content

Conversation

@philipp-spiess
Copy link
Contributor

This PR includes a test that I've enabled in #13358 and another test that we've discussed in #13462 as well as some random cleanup while I'm at it.

I found a test that was written more than 5 years ago and probably never
run until now. The behavior still works, although the API changed quite
a bit over the years.

Seems like this was part of the initial public release already:

facebook@75897c2#diff-1bf5126edab96f3b7fea034cd3b0c742R31
// This is a special case for submit and reset events as they are listened on
// at the element level and not the document.
// @see https://github.com/facebook/react/pull/13462
it('should not receive submit events if native, interim DOM handler prevents it', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test indeed fails if I re-apply my changes from #13358. If the onSubmit handler added a preventDefault(), this would never be called.

Copy link
Collaborator

@gaearon gaearon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


formRef.current.dispatchEvent(
new Event('reset', {
// https://developer.mozilla.org/en-US/docs/Web/Events/reset
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@philipp-spiess philipp-spiess merged commit 3661616 into facebook:master Aug 22, 2018
@philipp-spiess philipp-spiess deleted the submit-tests branch August 22, 2018 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants