import Component  from '../component.js'
import CoEuiChip from './eui-chip.js'
import CoEuiIcon from './eui-icon.js'
import CoEuiIconSvg from './eui-icon-svg.js'

export default class CoEuiChipListChipContainer extends Component {
    constructor(parent) {
      let selector = 'div[contains(@class, "eui-chip-list__chip-container")]';
      super(parent, selector);
      // https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-chip-list/eui-chip-list.component.html
    }
    get euiChipCO() {
      return new CoEuiChip(this.currentPath);
    }
    get euiIconCO() {
      return new CoEuiIcon(this.euiChipCO);
    }
    async hasChipIconClass() {
      return await (await $(this.euiIconCO.currentPath)).isExisting();
    }
    get title() {
      let path = '//span[@title]';
      return this.euiChipCO.currentPath + path;
    }
    async hasChipsLabelTruncateCount () {
      return await (await $(this.title)).isExisting();
    }
    get euiIconSvgCO(){
      return new CoEuiIconSvg(this.euiChipCO);
    }
    async hasChipIconSvg() {
      return await (await this.euiIconSvgCO.element()).isExisting();
    }
    async hasChipsLabelTruncateCount() {
      return await(await $(this.chipLabel)).isExisting();
    }
    get chipContent(){
      let path = '//span[not(@title)]';
      return this.euiChipCO.currentPath + path;
    }
}


