"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.stepperDriverFactory = void 0;
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _unidriver = require("../utils/test-utils/unidriver");
var _TextUni = require("../Text/Text.uni.driver");
var _constants = require("./constants");
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var stepperDriverFactory = base => {
  var byHook = dataHook => "[data-hook=\"".concat(dataHook, "\"]");
  var steps = base.$$(byHook(_constants.DataHook.Step));
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base)), {}, {
    /** Returns the style type. */
    getType: function () {
      var _getType = (0, _asyncToGenerator2.default)(function* () {
        return base.attr('data-type');
      });
      function getType() {
        return _getType.apply(this, arguments);
      }
      return getType;
    }(),
    /** Returns size. */
    getSize: function () {
      var _getSize = (0, _asyncToGenerator2.default)(function* () {
        return base.attr('data-size');
      });
      function getSize() {
        return _getSize.apply(this, arguments);
      }
      return getSize;
    }(),
    /** Returns the fit mode. */
    getFit: function () {
      var _getFit = (0, _asyncToGenerator2.default)(function* () {
        return base.attr('data-fit');
      });
      function getFit() {
        return _getFit.apply(this, arguments);
      }
      return getFit;
    }(),
    /** Click step at index. */
    clickStep: function () {
      var _clickStep = (0, _asyncToGenerator2.default)(function* (index) {
        yield steps.get(index).click();
      });
      function clickStep(_x) {
        return _clickStep.apply(this, arguments);
      }
      return clickStep;
    }(),
    /** Hover step at index. */
    hoverStep: function () {
      var _hoverStep = (0, _asyncToGenerator2.default)(function* (index) {
        yield steps.get(index).hover();
      });
      function hoverStep(_x2) {
        return _hoverStep.apply(this, arguments);
      }
      return hoverStep;
    }(),
    /** Returns the number of rendered steps. */
    getNumberOfSteps: function () {
      var _getNumberOfSteps = (0, _asyncToGenerator2.default)(function* () {
        return steps.count();
      });
      function getNumberOfSteps() {
        return _getNumberOfSteps.apply(this, arguments);
      }
      return getNumberOfSteps;
    }(),
    /** Returns whether the step at index is active or not. */
    isStepActive: function () {
      var _isStepActive = (0, _asyncToGenerator2.default)(function* (index) {
        return (yield steps.get(index).attr('data-active')) === 'true';
      });
      function isStepActive(_x3) {
        return _isStepActive.apply(this, arguments);
      }
      return isStepActive;
    }(),
    /** Returns the type of step at index. */
    getStepType: function () {
      var _getStepType = (0, _asyncToGenerator2.default)(function* (index) {
        return steps.get(index).attr('data-type');
      });
      function getStepType(_x4) {
        return _getStepType.apply(this, arguments);
      }
      return getStepType;
    }(),
    /** Returns the text content of step at index. */
    getStepText: function () {
      var _getStepText = (0, _asyncToGenerator2.default)(function* (index) {
        var textDriver = (0, _TextUni.textUniDriverFactory)(steps.get(index).$(byHook(_constants.DataHook.StepText)));
        return textDriver.getText();
      });
      function getStepText(_x5) {
        return _getStepText.apply(this, arguments);
      }
      return getStepText;
    }()
  });
};
exports.stepperDriverFactory = stepperDriverFactory;
//# sourceMappingURL=Stepper.uni.driver.js.map