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

export default class CoEuiToolbarMenuItemChild extends Component {
  constructor(parent) {
    let selector = 'li[contains(@class, "child")]';
    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 routerLink() {
    return this.currentPath + '//a[@routerLink]';
  }
  get routerLinkIcon() {
    return this.routerLink + '//span[contains(@class, "eui-icon")]';
  }
  async hasSubLinkUrl() {
    return await (await $(this.routerLink)).isExisting();
  }
  get noLink() {
    return this.currentPath + '//a[not(@routerLink)]';
  }
  get noLinkIcon() {
    return this.noLink + '//span[contains(@class, "eui-icon")]';
  }
  async noSubLinkUrl() {
    return await (await $(this.noLinkIcon)).isExisting();
  }
  get ulShowCO() {
    return new UlComponent(this.currentPath).byAttributeContains('class', 'show');
  }
  get children() {
    return new CoEuiToolbarMenuItemSubChild(this.ulShowCO);
  }
}


