import { h } from 'preact'; import { render, waitFor } from '@testing-library/preact'; import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; import { FocusTrap } from '../focusTrap'; describe('', () => { it('should trap focus within crayon-modals', async () => { const { getByTestId } = render(
, ); const firstInput = getByTestId('firstInput'); await waitFor(() => expect(firstInput).toHaveFocus()); userEvent.tab(); userEvent.tab(); expect(firstInput).toHaveFocus(); }); });