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: pointer API #742

Closed
4 tasks done
ph-fritsche opened this issue Oct 15, 2021 · 0 comments · Fixed by #750
Closed
4 tasks done

feat: pointer API #742

ph-fritsche opened this issue Oct 15, 2021 · 0 comments · Fixed by #750
Labels
enhancement New feature or request
Milestone

Comments

@ph-fritsche
Copy link
Member

ph-fritsche commented Oct 15, 2021

Create an abstract pointer API that handles the state of pointer devices. See #714
It shall be used to internally replace our implementations of pointer related APIs.

  • Press and release mouse buttons
    This should be analog to the keyboard implementation.
    const pointerState = user.pointer('[MouseLeft>]')
    user.pointer('[/MouseLeft]', {pointerState})
  • Move the pointer
    This will be limited by the fact that our primary target environment jsdom has no layout.
    But like we already support hover we should add the option to
    • Move the pointer from one element to another.
      This should trigger the appropriate leave and enter events on the related targets.
      This will neglect that we do not know the layout relation between those elements, i.e. if the elements will be rendered beside each other and moving the pointer will therefore be possible or if one renders over the other or outside of the viewport.
      This will also neglect any other elements that might render between the two elements and therefore would also receive pointer events in a browser environment.
    • Move the pointer to specified coordinates on the element.
      As for moving the pointer from one element to another, testing this with userEvent can not give confidence that the layout allows such movement. But it can be used to ensure that event handlers are correctly wired and work in principle.
@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Oct 15, 2021
@ph-fritsche ph-fritsche added the enhancement New feature or request label Oct 15, 2021
@ph-fritsche ph-fritsche mentioned this issue Oct 19, 2021
3 tasks
@ph-fritsche ph-fritsche linked a pull request Oct 19, 2021 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant