import { removeStartingTilde } from '../utils' ; import { isString } from '../internal/utils' ; export enum IOS_PREDICATE_ATTRIBUTES { NAME = 'name' , VALUE = 'value' , LABEL = 'label' , RECT = 'rect' , TYPE = 'type' , ENABLED = 'enabled' , VISIBLE = 'visible' , ACCESSIBLE = 'accessible' , ACCESSIBILITY_CONTAINER = 'accessibilityContainer' } export enum IOS_PREDICATE_COMPARATOR { EQUALS = '==' , NOT_EQUALS = '!=' , CONTAINS = 'CONTAINS' , BEGINS_WITH = 'BEGINSWITH' , ENDS_WITH = 'ENDSWITH' , LIKE = 'LIKE' , MATCHES = 'MATCHES' } export class IosSelector < T > { attribute : IOS_PREDICATE_ATTRIBUTES ; comparator : IOS_PREDICATE_COMPARATOR ; value : T ; private constructor ( attribute , comparator , value ) { this . attribute = attribute ; this . comparator = comparator ; this . value = value ; } public static of < T > ( attribute , comparator , value ) { return new IosSelector < T > ( attribute , comparator , value ) ; } toString ( ) { let selector = this . attribute + ' ' + this . comparator + ' ' ; if ( isString ( this . value ) ) { selector += "'" + removeStartingTilde ( ( this . value as unknown ) as string ) + "'" ; } else { selector += this . value ; } return selector ; } }