import Component from '../../component.js';
import ButtonComponent from '../../button.js';
import CoUxDropdownButton from './ux-dropdown-button.js';
import { elementAttributeContains } from '../../../core/utils.js';

export default class CoUxSplitButton extends Component {
    constructor(parent) {
      let selector = 'ux-split-button';
      super(parent, selector);
      //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/src/lib/ux-components/ux-split-button/ux-split-button.component.ts
    }
    get dataE2E() {
      return this.currentPath + '//div[@data-e2e="ux-split-button"]';
    }
    get buttonCo() {
      return new ButtonComponent(this.dataE2E);
    }
    get dropDownButtonCo() {
      return new CoUxDropdownButton(this.dataE2E);
    }
    async typeClass() {
      return await (await $(this.currentPath)).getAttribute('typeclass');
    }
    async isOutline() {
      let btnIsOutline = await elementAttributeContains(this.buttonCo.currentPath, 'class', 'ux-button--outline ');
      let dropDownBtn = new ButtonComponent(this.dropDownButtonCo.buttonCO.currentPath);
      let dropdwnBtnIsOutline = await elementAttributeContains(dropDownBtn.currentPath, 'class', 'ux-button--outline ');
      return await (btnIsOutline && dropdwnBtnIsOutline);
    }

}


