license import { dispatchFakeEvent } from './dispatch-events' ; function triggerFocusChange ( element , event ) { let eventFired = false ; const handler = ( ) => ( eventFired = true ) ; element . addEventListener ( event , handler ) ; element [ event ] ( ) ; element . removeEventListener ( event , handler ) ; if ( ! eventFired ) { dispatchFakeEvent ( element , event ) ; } } docs-private export function patchElementFocus ( element ) { element . focus = ( ) => dispatchFakeEvent ( element , 'focus' ) ; element . blur = ( ) => dispatchFakeEvent ( element , 'blur' ) ; } docs-private export function triggerFocus ( element ) { triggerFocusChange ( element , 'focus' ) ; } docs-private export function triggerBlur ( element ) { triggerFocusChange ( element , 'blur' ) ; }