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

Set default event flags appropriate for event type #131

Merged
merged 2 commits into from
Nov 9, 2021

Conversation

robertknight
Copy link
Member

@robertknight robertknight commented Jan 12, 2021

Set the bubbles, cancelable and composed flags to match the
default value of these flags for a given event type.

  • Add a metadata map in src/event-data.ts which is adapted from
    dom-testing-library and describes the default init args and
    constructors for different events.

    Note that the event constructor is not currently used. That will
    happen separately.

  • Use this metadata in MountRenderer to set the default arguments
    passed to the Event constructor's second argument, unless
    overridden

Fixes #129


TODO:

  • Review the correctness / completeness of the event-data.ts data

@mq2thez
Copy link

mq2thez commented Nov 8, 2021

Hey @robertknight, I know it's been a while, but I was hoping to check in on the status of this -- we just got bitten by this again while debugging a test being migrated onto Enzyme.

Set the `bubbles`, `cancelable` and `composed` flags to match the
default value of these flags for a given event type.

 - Add a metadata map in `src/event-data.ts` which is adapted from
   `dom-testing-library` and describes the default init args and
   constructors for different events.

   Note that the event constructor is not currently used. That will
   happen separately.

 - Use this metadata in `MountRenderer` to set the default arguments
   passed to the `Event` constructor's second argument, unless
   overridden

Fixes #129
Rename the event data module to match the current version of the module
in dom-testing-library, from which it was taken. A few additional
events have been added. There are still some additional media events in
the DTL version which have not been added here yet.
@robertknight robertknight marked this pull request as ready for review November 9, 2021 08:44
@robertknight
Copy link
Member Author

robertknight commented Nov 9, 2021

Hi @mq2thez - I've had another look over this and checked that it doesn't cause unexpected issues in the test suites for the main codebases I work on. Can you confirm that it works as expected in your test suites? If so I'm happy to ship this.

@mq2thez
Copy link

mq2thez commented Nov 9, 2021

@robertknight Happy to report that after installing this branch, our full Jest suite still passes, and some individual tests I wrote to confirm the propagation happened pass as expected. Looks good to go! Thank you so much!

@robertknight robertknight merged commit 5280125 into master Nov 9, 2021
@robertknight robertknight deleted the set-event-flags branch November 9, 2021 12:01
@robertknight
Copy link
Member Author

This has been published as v3.3.0.

@mq2thez
Copy link

mq2thez commented Nov 9, 2021

Awesome, thanks a ton! This will definitely be a time saver =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update mount adapter so that events bubble by default
2 participants