import { ElementCondition , NullableLocatable } from '../Condition' ; import { EvaluateFn } from '../types' ; export class ElementStateCondition extends ElementCondition { constructor ( desc , locator , ... args ) { super ( desc , locator ) ; this . pageFuncArgs = args ; } toString ( ) { const [ disabled ] = this . pageFuncArgs ; return `for element to become ${ disabled ? 'disabled' : 'enabled' }` ; } pageFunc : EvaluateFn = ( node , waitForDisabled ) => { if ( ! node ) return false ; return ( node as any ) [ 'disabled' ] === waitForDisabled ; } ; async waitForEvent ( ) { return null ; } }