import Component from '../component.js';
import DivComponent from '../div.js';
import CoEuiIconButton from './eui-icon-button.js';

export default class CoEuiTabsItem extends Component {
  constructor(parent) {
    let selector = 'div[contains(@class, "eui-tab-item")][@tabindex]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-tabs/eui-tabs.component.html?at=master
  }
  async isClosable() {
    return await (await $(this.currentPath + '/self::*[contains(@class,"eui-tab-item--closable")]')).isExisting();
  }
  async isActive() {
    return await (await $(this.currentPath + '/self::*[contains(@class,"eui-tab-item--active")]')).isExisting();
  }
  async isDisabled() {
    return await (await $(this.currentPath + '/self::*[contains(@class,"eui-tab-item--disabled")]')).isExisting();
  }
  get labelCO() {
    return new DivComponent(this.currentPath).addPredicateClassContains('eui-tab-item__label');
  }
  get closeButtonCO() {
    return new CoEuiIconButton(this.currentPath).addPredicateIconContains('close');
  }
}

