@ryusei/code
Version:
<div align="center"> <a href="https://code.ryuseijs.com"> <img alt="RyuseiCode" src="https://code.ryuseijs.com/images/svg/logo.svg" width="70"> </a>
18 lines (11 loc) • 376 B
text/typescript
import { focus } from './focus';
describe( 'focus', () => {
test( 'can make an element focused if it is focusable.', () => {
const div = document.createElement( 'div' );
div.tabIndex = 0;
document.body.appendChild( div );
expect( document.activeElement ).not.toBe( div );
focus( div );
expect( document.activeElement ).toBe( div );
} );
} );