Skip to content
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

fix: load and error dispatch Event instead of UIEvent #1147

Merged
merged 1 commit into from Jul 9, 2022

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Jul 9, 2022

What:

fireEvent.load (et. al.) dispatches a Event now instead of UIEvent
Adds a test for #498

Why:

I imagine that the most common targets are <img /> and <script /> and neither of these receive load events as UIEvent: https://codesandbox.io/s/react-script-does-not-work-the-way-you-think-it-does-stc66c

How:

Changed event type and added tests for <script />. Ieft a note that our abstraction doesn't support firing events with different types.

Also removed the notion of "Image events" from comments. We refer to DOM interfaces in all other cases. But there is no such thing as ImageEvent.

Checklist:

  • [ ] Documentation added to the
    docs site
  • Tests
  • [ ] TypeScript definitions updated
  • Ready to be merged

@eps1lon eps1lon added the bug Something isn't working label Jul 9, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 9, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 25b044b:

Sandbox Source
react-testing-library-examples Configuration
React: <script /> does not work the way you think it does PR

@codecov
Copy link

codecov bot commented Jul 9, 2022

Codecov Report

Merging #1147 (25b044b) into main (54bfa48) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main     #1147   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines          985       985           
  Branches       321       325    +4     
=========================================
  Hits           985       985           
Flag Coverage Δ
node-12 100.00% <ø> (ø)
node-14 100.00% <ø> (ø)
node-16 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/event-map.js 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54bfa48...25b044b. Read the comment docs.

@eps1lon eps1lon marked this pull request as ready for review July 9, 2022 09:02
Copy link
Member

@MatanBobi MatanBobi left a comment

Choose a reason for hiding this comment

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

This looks good to me. Was there an issue about this somewhere? I see nothing linked.

Edit: found the issue, sorry about that :)

@eps1lon eps1lon merged commit 29a17cb into testing-library:main Jul 9, 2022
@eps1lon eps1lon deleted the fix/script-onload branch July 9, 2022 11:05
@github-actions
Copy link

github-actions bot commented Jul 9, 2022

🎉 This PR is included in version 8.14.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants