Created
February 8, 2024 11:51
-
-
Save Nelfimov/ade5263ea89d82a240368fe7aa8c09ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @jest-environment jsdom | |
*/ | |
import { act } from '@testing-library/react' | |
import { renderHook } from '@testing-library/react' | |
import { useFocus } from './use-focus.hook' | |
describe('Use focus hook', () => { | |
it('should change focus', () => { | |
const { result } = renderHook(() => useFocus()) | |
act(() => result.current.focusProps.onFocus()) | |
expect(result.current.focus).toBeTruthy() | |
act(() => result.current.focusProps.onBlur()) | |
expect(result.current.focus).toBeFalsy() | |
}) | |
}) |
Author
Nelfimov
commented
Feb 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment