import Component  from '../component.js'
import { elementAttributeContains } from '../../core/utils.js'

export default class CoEuiInputText extends Component {
  constructor(parent) {
    let selector = 'input[@euiInputText]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-input-text
  }

  async isInvalid() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-input-text--invalid');
  }
  async isLoading() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-input-text--loading');
  }
  async isReadOnly() {
    return await (await $(this.currentPath)).getAttribute('readonly');
  }
  async isDisabled() {
    return await (await $(this.currentPath)).getAttribute('disabled');
  }
  async placeholder(){
    return await (await $(this.currentPath)).getAttribute('placeholder');
  }
  async isClearable() {
    return await elementAttributeContains(this.currentPath, 'class', 'eui-input-text--clearable');
  }
}


