import Component  from '../component.js';
import UlComponent from '../ul.js';
import CoEuiToolbarMenuItemChild from './eui-toolbar-menu-item-child.js';

export default class CoEuiToolbarMenuItem extends Component {
  constructor(parent) {
    let selector = 'li[@routerLinkActive="selected"]';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/layout/eui-toolbar/toolbar-menu/toolbar-menu.component.html?at=support%2F13.x
  }
  get tabIndexLink() {
    return this.currentPath + '//a[@tabindex]';
  }
  get tabIndexLinkIcon() {
    return this.tabIndexLink + '//span[contains(@class, "eui-icon") and contains(@class, "eui-icon-angle-right")]';
  }
  async noLinkUrl() {
    return await (await $(this.tabIndexLink)).isExisting();
  }
  get routerLink() {
    return this.currentPath + '//a[@routerLink]';
  }
  get routerLinkIcon() {
    return this.routerLink + '//span[contains(@class, "eui-icon") and contains(@class, "eui-icon-angle-right")]';
  }
  async hasLinkUrl() {
    return await (await $(this.routerLink)).isExisting();
  }
  get ulShowCO() {
    return new UlComponent(this.currentPath).byAttributeContains("class", "show");
  }
  get children() {
    return new CoEuiToolbarMenuItemChild(this.ulShowCO);
  }
  async hasChildren() {
    return await (await $(this.children.currentPath)).isExisting();
  }
}


