import React from 'react'; import { render, fireEvent, waitFor } from '@testing-library/react'; import { screen } from '@testing-library/dom'; import { axe } from 'jest-axe'; import 'jest-styled-components'; import 'jest-axe/extend-expect'; import 'regenerator-runtime/runtime'; import userEvent from '@testing-library/user-event'; import { Box } from '../../Box'; import { Button } from '../../Button'; import { Grommet } from '../../Grommet'; import { Tip } from '..'; describe('Tip', () => { test('should have no accessibility violations', async () => { const { container } = render( Example , ); const results = await axe(container); expect(results).toHaveNoViolations(); expect(container.firstChild).toMatchSnapshot(); }); test(`mouseOver and mouseOut events on the Tip's child`, async () => { const { getByText } = render( tooltip } > Test Events , ); fireEvent.mouseOver(getByText('Test Events')); const tooltip = await waitFor(() => screen.getByText('tooltip')); expect(document.getElementById('tooltip-id')).not.toBeNull(); expect(tooltip?.parentNode?.parentNode).toMatchSnapshot(); fireEvent.mouseOut(getByText('Test Events')); expect(document.getElementById('tooltip-id')).toBeNull(); }); test(`focus and blur events on the Tip's child`, async () => { const { container, getByText } = render(