Skip to content

Testing Selecto in react with jest #83

@PhilippJunginger

Description

@PhilippJunginger

Environments

  • Framework name: React
  • Testing Environment: Jest
  • Framework version: React 17
  • Component name: react-selecto
  • Component version: 1.16.2
  • Testable Address(optional):

Description

Hello!

I am currently trying to Test the behaviour of the Selecto-Component.
I implemented a feature, where the User enters a select-mode after a button click. In the select-mode the user can click or drag-to-select items to add them to a selectedItems-state.

While Testing:
When I click an Item with userEvent after I have clicked the button for select-mode, I get the Error that

'TypeError: document.elementFromPoint is not a function' and the test fails on the userEvent. If I replace it with fireEvent.click instead of userEvent.click it runs through.

However, when trying to test the dragging with fireEvent.mouseDown/mouseMove/mouseUp, I get the TypeError again that elementFromPoint is not defined.

Does anyone have experience with testing Selecto and can help me out?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomplete

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions