"use strict";

exports.__esModule = true;
exports.TabsFilterUniDriver = TabsFilterUniDriver;
exports.default = void 0;
var _unidriver = require("@wix/design-system/dist/testkit/unidriver");
var _unidriver2 = require("../../unidriver");
function TabsFilterUniDriver(base, body) {
  const tabsBase = () => base.$('[data-hook="tabs-default"]');
  const tabsUniDriver = (0, _unidriver.TabsUniDriver)(tabsBase(), body);
  const getTabs = () => tabsBase().$$('[data-hook="tabs-filter-tab-title"]');
  const getTabAt = index => getTabs().get(index);
  return {
    /**
     * Wait for tabs filter to render
     * @param timeout
     */
    wait: timeout => base.wait(timeout),
    ...(0, _unidriver2.baseUniDriverFactory)(base),
    /**
     * Get all tabs titles text
     */
    getTitles: () => getTabs().map(e => e.$('[data-hook="title-text"]').text()),
    /**
     *
     * Get all tabs total text (requires <TabTotalParens />)
     */
    getParensTotals: () => getTabs().map(e => e.$('[data-hook="title-badge"]').$('[data-hook="total"]').text()),
    /**
     * Get all tabs total text (requires <TabTotalCounterBadge />)
     */
    getCounterBadgeTotals: () => getTabs().map(e => e.$('[data-hook="title-badge"]').text()),
    /**
     * Get the index of the current active tab
     */
    getActiveTabIndex: () => tabsUniDriver.getActiveTabIndex(),
    /**
     * Click a tab
     * @param index
     */
    clickTabAt: index => tabsUniDriver.clickTabAt(index),
    /**
     * Hover a tab
     * @param index
     */
    hoverTabAt: index => getTabAt(index).hover(),
    /**
     * Get the title text of a tab
     * @param index
     */
    getTitleTextAt: index => getTabs().get(index).$('[data-hook="title-text"]').text(),
    /**
     * Get the total text of a tab (requires <TabTotalCounterBadge />)
     * @param index
     */
    getTotalBadgeTextAt: index => getTabs().get(index).$('[data-hook="title-badge"]').text(),
    /**
     * Get the total text of a tab (requires <TabTotalParens />)
     * @param index
     */
    getTotalParensTextAt: index => getTabs().get(index).$('[data-hook="title-badge"]').$('[data-hook="total"]').text(),
    dropdown: () => (0, _unidriver.InputWithOptionsUniDriver)(base.$('[data-hook="tabs-dropdown"]'), body),
    tabsBadgesExists: () => getTabs().at(0).$('[data-hook="title-badge"]').exists()
  };
}
var _default = exports.default = TabsFilterUniDriver;
//# sourceMappingURL=TabsFilter.uni.driver.js.map