import { elementAttributeContains } from '../../core/utils.js';
import ButtonComponent from '../button.js';
import Component from '../component.js';
import CoEuiIconSvg from './eui-icon-svg.js';

export default class CoEuiIconButtonExpander extends Component {
  constructor(parent) {
    let selector = 'eui-icon-button-expander';
    super(parent, selector);
    //https://citnet.tech.ec.europa.eu/CITnet/stash/projects/CSDR/repos/eui/browse/packages/components/eui-icon-button-expander/eui-icon-button-expander.component.html
  }
  get toggleCO() {
    return new ButtonComponent(this.currentPath).addPredicateClassContains('eui-icon-button-expander-toggle');
  }
  async isExpanded() {
    return await elementAttributeContains(this.toggleCO.currentPath, 'class', 'eui-icon-button-expander-toggle--expanded');
  }
  get iconForwardCO() {
    return new CoEuiIconSvg(this.toggleCO).addPredicateIconContains('chevron-forward');
  }
  get iconDownCO() {
    return new CoEuiIconSvg(this.toggleCO).addPredicateIconContains('chevron-down');
  }
  async isFillColor() {
    return await (await $(this.iconForwardCO.currentPath + '/self::*[@fillColor]')).isExisting();
  }
}
