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(event): assign pointer coords to MouseEvent #1039

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

ph-fritsche
Copy link
Member

What:

Assign missing pointer coords.

Why:

Closes #1037

Checklist:

  • Tests
  • Ready to be merged

@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 d5a2f34:

Sandbox Source
userEvent-dom Configuration
userEvent-react Configuration
smoosh-firefly-o0d0y6 Issue #1037

@codecov
Copy link

codecov bot commented Aug 18, 2022

Codecov Report

Merging #1039 (d5a2f34) into main (1aa2027) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##              main     #1039   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           88        88           
  Lines         2061      2061           
  Branches       691       701   +10     
=========================================
  Hits          2061      2061           
Impacted Files Coverage Δ
src/event/createEvent.ts 100.00% <ø> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@liamcmitchell-sc
Copy link

Note this fix may break with future JSDOM versions:

jestjs/jest#13825 (comment)

@ph-fritsche
Copy link
Member Author

@liamcmitchell-sc The properties are assigned as a getter per Object.defineProperty.

function assignProps<T extends object>(obj: T, props: {[k in keyof T]?: T[k]}) {
for (const [key, value] of Object.entries(props)) {
Object.defineProperty(obj, key, {get: () => value ?? null})
}
}

@liamcmitchell-sc
Copy link

@ph-fritsche ah thanks, didn't get that deep.

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.

14.4: pageX and pageY coords are not passed to MouseEvent from pointer() call
2 participants