"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _testUtils = _interopRequireDefault(require("react-dom/test-utils"));
var tabsDriverFactory = _ref => {
  var {
    element
  } = _ref;
  var findFirst = query => element.querySelector(query);
  var getItemsContainer = () => findFirst('div[role="tablist"]');
  var getItems = () => [...getItemsContainer().childNodes];
  var getItemsContainerType = () => getItemsContainer().getAttribute('data-type');
  return {
    exists: () => !!element,
    getTitles: () => getItems().map(item => item.textContent),
    clickTabAt: index => _testUtils.default.Simulate.click(getItems()[index]),
    getActiveTabIndex: () => getItems().findIndex(item => item.getAttribute('data-active') === 'true'),
    isDefaultType: () => !getItemsContainerType(),
    getItemsContainerType,
    getDataHook: index => getItems()[index].getAttribute('data-hook'),
    getItemsWidth: () => new Set(getItems().map(item => item.style.width)),
    hasDivider: () => element.getAttribute('data-divider') === 'true',
    sideContent: findFirst("[data-content=\"true\"]"),
    getSideContent: () => findFirst("[data-content=\"true\"]"),
    getItemsMaxWidths: () => getItems().map(item => item.style.maxWidth),
    getItemsMinWidths: () => getItems().map(item => item.style.minWidth)
  };
};
var _default = exports.default = tabsDriverFactory;
//# sourceMappingURL=Tabs.driver.js.map