UNPKG

@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>

17 lines (12 loc) 474 B
import { activeElement } from './activeElement'; describe( 'activeElement', () => { test( 'can return an active element.', () => { expect( document.activeElement ).toBe( activeElement() ); } ); test( 'can return an element that is currently focused.', () => { const textarea = document.createElement( 'textarea' ); document.body.appendChild( textarea ); textarea.focus(); expect( activeElement() ).toBe( textarea ); } ); } );