"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.sidebarItemButtonNextDriverFactory = 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 _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 sidebarItemButtonNextDriverFactory = (base, body) => {
  var getPrefix = () => (0, _unidriver.findByHook)(base, _constants.dataHooks.prefix);
  var getSuffix = () => (0, _unidriver.findByHook)(base, _constants.dataHooks.suffix);
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base, body)), {}, {
    /**
     * Returns if the sidebar item is selected
     * @returns {Promise<boolean>}
     */
    isSelected: function () {
      var _isSelected = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr('data-selected')) === 'true';
      });
      function isSelected() {
        return _isSelected.apply(this, arguments);
      }
      return isSelected;
    }(),
    /**
     * Returns if the sidebar item is disabled
     * @returns {Promise<boolean>}
     */
    isDisabled: function () {
      var _isDisabled = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr('data-disabled')) === 'true';
      });
      function isDisabled() {
        return _isDisabled.apply(this, arguments);
      }
      return isDisabled;
    }(),
    /**
     * Returns if a suffix exists
     * @returns {Promise<boolean>}
     */
    suffixExists: function () {
      var _suffixExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield getSuffix()).exists();
      });
      function suffixExists() {
        return _suffixExists.apply(this, arguments);
      }
      return suffixExists;
    }(),
    /**
     * Returns count of suffix items
     * @returns {Promise<number>}
     */
    getSuffixCount: function () {
      var _getSuffixCount = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.countByHook)(base, _constants.dataHooks.suffix);
      });
      function getSuffixCount() {
        return _getSuffixCount.apply(this, arguments);
      }
      return getSuffixCount;
    }(),
    /**
     * Returns if a prefix exists
     * @returns {Promise<boolean>}
     */
    prefixExists: function () {
      var _prefixExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield getPrefix()).exists();
      });
      function prefixExists() {
        return _prefixExists.apply(this, arguments);
      }
      return prefixExists;
    }(),
    /**
     * Returns the skin
     * @returns {Promise<string>}
     */
    getSkin: function () {
      var _getSkin = (0, _asyncToGenerator2.default)(function* () {
        return base.attr('data-skin');
      });
      function getSkin() {
        return _getSkin.apply(this, arguments);
      }
      return getSkin;
    }(),
    /**
     * Returns the displayed text
     * @returns {Promise<string>}
     * */
    getText: function () {
      var _getText = (0, _asyncToGenerator2.default)(function* () {
        return base.text();
      });
      function getText() {
        return _getText.apply(this, arguments);
      }
      return getText;
    }()
  });
};
exports.sidebarItemButtonNextDriverFactory = sidebarItemButtonNextDriverFactory;
//# sourceMappingURL=SidebarItemButtonNext.uni.driver.js.map