import Component  from '../component.js';
import DivComponent from '../div.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiDropdownItem extends Component {
    constructor(parent) {
      let selector = '*[self::eui-dropdown-item or self::*[@euiDropdownItem]]';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-dropdown/dropdown-item/eui-dropdown-item.component.html?at=master
    }
    async isActive() {
      return await (await $(this.currentPath + '/self::*[contains(@class,"eui-dropdown-item--active")]')).isExisting();
    }
    get containerCO() {
      return new DivComponent(this.currentPath).addPredicateClassContains('eui-dropdown-item__container');
    }
    get contentCO() {
      return new DivComponent(this.containerCO).addPredicateClassContains('eui-dropdown-item__content');
    }
    get contentTextCO() {
      return new DivComponent(this.contentCO).addPredicateClassContains('eui-dropdown-item__content-text');
    }
    get contentIconCO() {
      return new DivComponent(this.contentCO).addPredicateClassContains('eui-dropdown-item__content-icon');
    }
    async hasSubDropdown(){
      return await(await this.contentIconCO.element()).isExisting();
    }
    get iconCO() {
      return new CoEuiIconSvg(this.contentIconCO).addPredicateIconContains('chevron-forward');
    }
}


