Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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');
});
it('should display correct tool tip on mouseEnter', async () => {
const { getByTitle, getByText } = render(HoverWrapper);
const button = getByTitle('ophan').parentNode as HTMLButtonElement;
fireEvent.mouseEnter(button);
const ToolTip = await waitForElement(() => getByText('ophan'));
expect(ToolTip).toBeTruthy();
});
it('should NOT open the menu when hovered if the event type is "click"', () => {
const { getByTestId } = render(
+} event="click">
+
);
const fab = getByTestId('fab');
fireEvent.mouseEnter(fab);
expect(fab).not.toHaveClass('rtf open');
expect(fab).toHaveClass('rtf closed');
});
fireEvent.invalid(htmlEl);
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);