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

feat!: remove support for user provided MouseEventInit #784

Merged
merged 1 commit into from
Nov 16, 2021

Conversation

ph-fritsche
Copy link
Member

@ph-fritsche ph-fritsche commented Nov 15, 2021

BREAKING CHANGE: init parameter has been removed from these APIs:

  • userEvent.click
  • userEvent.dblClick
  • userEvent.tripleClick
  • userEvent.hover
  • userEvent.unhover
  • userEvent.selectOptions
  • userEvent.deselectOptions

BREAKING CHANGE: userEvent.upload no longer supports clickInit
as part of its init parameter.

What:
Remove init parameters for EventInit of mouse/pointer events.

Why:
The init parameters are escape hatches.
They were used for different events that don't necessarily share the same properties.

The new pointer implementation renders supplying own MouseEventInit properties obsolete as the events are created according to specs / living standard.
If our code lacks non-deprecated features from the specs, we should add them.
If our users want to test features outside of the specs, they should be on their own using lower level implementations.

The init parameter encourages bad practice as it makes it convenient to just tweak the events instead of describing a user interaction that might lead up to those events.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged -- The code is ready, but I'd like a second opinion on this.

@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Nov 15, 2021
BREAKING CHANGE: `init` parameter has been removed from these APIs:
- `userEvent.click`
- `userEvent.dblClick`
- `userEvent.tripleClick`
- `userEvent.hover`
- `userEvent.unhover`
- `userEvent.selectOptions`
- `userEvent.deselectOptions`

BREAKING CHANGE: `userEvent.upload` no longer supports `clickInit`
as part of its `init` parameter.
@codesandbox-ci
Copy link

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 3720704:

Sandbox Source
userEvent-PR-template Configuration

@codecov
Copy link

codecov bot commented Nov 15, 2021

Codecov Report

Merging #784 (3720704) into alpha (826cb63) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             alpha      #784   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           64        64           
  Lines         1394      1393    -1     
  Branches       545       544    -1     
=========================================
- Hits          1394      1393    -1     
Impacted Files Coverage Δ
src/hover.ts 100.00% <ø> (ø)
src/click.ts 100.00% <100.00%> (ø)
src/selectOptions.ts 100.00% <100.00%> (ø)
src/setup.ts 100.00% <100.00%> (ø)
src/upload.ts 100.00% <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 826cb63...3720704. Read the comment docs.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

I'm in favor of this change. I never liked this API 👍

@ph-fritsche ph-fritsche merged commit d598fb6 into alpha Nov 16, 2021
@ph-fritsche ph-fritsche deleted the remove-init branch November 16, 2021 09:01
@github-actions
Copy link

🎉 This PR is included in version 14.0.0-alpha.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

ph-fritsche added a commit that referenced this pull request Nov 28, 2021
BREAKING CHANGE: `init` parameter has been removed from these APIs:
- `userEvent.click`
- `userEvent.dblClick`
- `userEvent.tripleClick`
- `userEvent.hover`
- `userEvent.unhover`
- `userEvent.selectOptions`
- `userEvent.deselectOptions`

BREAKING CHANGE: `userEvent.upload` no longer supports `clickInit`
as part of its `init` parameter.
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.

2 participants