How to use the react-testing-library.fireEvent.mouseLeave function in react-testing-library

To help you get started, we’ve selected a few react-testing-library examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dericgw / react-tiny-fab / src / __tests__ / fab.jsx View on Github external
it('should open the menu when hovered and close when exited', async () => {
      const { getByTestId } = render(
        +}>
          +
        
      );

      const fab = getByTestId('fab');

      // Sanity check to make sure that it is in fact closed
      expect(fab).not.toHaveClass('rtf open');
      fireEvent.mouseEnter(getByTestId('fab'));
      expect(fab).toHaveClass('rtf open');
      fireEvent.mouseLeave(getByTestId('fab'));
      expect(fab).not.toHaveClass('rtf open');
    });
github flow-typed / flow-typed / definitions / npm / react-testing-library_v5.x.x / flow_v0.67.1- / test_react-testing-library_v5.x.x.js View on Github external
fireEvent.submit(htmlEl);
    fireEvent.click(htmlEl);
    fireEvent.contextMenu(htmlEl);
    fireEvent.dblClick(htmlEl);
    fireEvent.doubleClick(htmlEl);
    fireEvent.drag(htmlEl);
    fireEvent.dragEnd(htmlEl);
    fireEvent.dragEnter(htmlEl);
    fireEvent.dragExit(htmlEl);
    fireEvent.dragLeave(htmlEl);
    fireEvent.dragOver(htmlEl);
    fireEvent.dragStart(htmlEl);
    fireEvent.drop(htmlEl);
    fireEvent.mouseDown(htmlEl);
    fireEvent.mouseEnter(htmlEl);
    fireEvent.mouseLeave(htmlEl);
    fireEvent.mouseMove(htmlEl);
    fireEvent.mouseOut(htmlEl);
    fireEvent.mouseOver(htmlEl);
    fireEvent.mouseUp(htmlEl);
    fireEvent.select(htmlEl);
    fireEvent.touchCancel(htmlEl);
    fireEvent.touchEnd(htmlEl);
    fireEvent.touchMove(htmlEl);
    fireEvent.touchStart(htmlEl);
    fireEvent.scroll(htmlEl);
    fireEvent.wheel(htmlEl);
    fireEvent.abort(htmlEl);
    fireEvent.canPlay(htmlEl);
    fireEvent.canPlayThrough(htmlEl);
    fireEvent.durationChange(htmlEl);
    fireEvent.emptied(htmlEl);
github guardian / facia-tool / client-v2 / src / shared / components / input / __tests__ / HoverActions.spec.tsx View on Github external
it('should hide tool tip on mouseLeave', () => {
    const { getByTitle, queryByText } = render(HoverWrapper);
    const button = getByTitle('view').parentNode as HTMLButtonElement;
    fireEvent.mouseLeave(button);
    wait(() => expect(queryByText('view')).toBeFalsy());
  });
});