"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.sidebarNextDriverFactory = 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");
var _IconButtonUni = require("../IconButton/IconButton.uni.driver");
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 sidebarNextDriverFactory = (base, body) => {
  var minimizeButtonDriver = (0, _IconButtonUni.iconButtonDriverFactory)((0, _unidriver.findByHook)(base, _constants.dataHooks.minimizeButton));
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base, body)), {}, {
    /**
     * Gets the current selected key
     * @returns {Promise<string>}
     */
    getSelectedKey: function () {
      var _getSelectedKey = (0, _asyncToGenerator2.default)(function* () {
        return base.attr('data-selected');
      });
      function getSelectedKey() {
        return _getSelectedKey.apply(this, arguments);
      }
      return getSelectedKey;
    }(),
    /**
     * Gets the current 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;
    }(),
    /**
     * Checks whether the sidebar is hidden
     * @returns {Promise<boolean>}
     */
    isHidden: function () {
      var _isHidden = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr('data-hidden')) === 'true';
      });
      function isHidden() {
        return _isHidden.apply(this, arguments);
      }
      return isHidden;
    }(),
    /**
     * Checks whether the header element exists
     * @returns {Promise<boolean>}
     */
    headerExists: function () {
      var _headerExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield (0, _unidriver.findByHook)(base, _constants.dataHooks.header)).exists();
      });
      function headerExists() {
        return _headerExists.apply(this, arguments);
      }
      return headerExists;
    }(),
    /**
     * Checks whether the footer element exists
     * @returns {Promise<boolean>}
     */
    footerExists: function () {
      var _footerExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield (0, _unidriver.findByHook)(base, _constants.dataHooks.footer)).exists();
      });
      function footerExists() {
        return _footerExists.apply(this, arguments);
      }
      return footerExists;
    }(),
    /**
     * Checks whether the skeleton is displayed
     * @returns {Promise<boolean>}
     */
    isLoading: function () {
      var _isLoading = (0, _asyncToGenerator2.default)(function* () {
        return (yield (0, _unidriver.findByHook)(base, _constants.dataHooks.skeleton)).exists();
      });
      function isLoading() {
        return _isLoading.apply(this, arguments);
      }
      return isLoading;
    }(),
    /**
     * Gets the current width
     * @returns {Promise<string>}
     */
    getWidth: function () {
      var _getWidth = (0, _asyncToGenerator2.default)(function* () {
        return base.attr('data-width');
      });
      function getWidth() {
        return _getWidth.apply(this, arguments);
      }
      return getWidth;
    }(),
    /**
     * Gets the current minimized state
     * @returns {Promise<boolean>}
     */
    isMinimized: function () {
      var _isMinimized = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr('data-minimized')) === 'true';
      });
      function isMinimized() {
        return _isMinimized.apply(this, arguments);
      }
      return isMinimized;
    }(),
    /**
     * Clicks on minimization button
     * @returns {Promise<void>}
     */
    clickOnMinimizeButton: function () {
      var _clickOnMinimizeButton = (0, _asyncToGenerator2.default)(function* () {
        return minimizeButtonDriver.click();
      });
      function clickOnMinimizeButton() {
        return _clickOnMinimizeButton.apply(this, arguments);
      }
      return clickOnMinimizeButton;
    }(),
    /**
     * Checks whether the minimize button exists
     * @returns {Promise<boolean>}
     */
    minimizeButtonExists: function () {
      var _minimizeButtonExists = (0, _asyncToGenerator2.default)(function* () {
        return minimizeButtonDriver.exists();
      });
      function minimizeButtonExists() {
        return _minimizeButtonExists.apply(this, arguments);
      }
      return minimizeButtonExists;
    }(),
    /**
     * Gets if the sidebar is next version
     * @returns {Promise<boolean>}
     */
    isNext: function () {
      var _isNext = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr('data-next')) === 'true';
      });
      function isNext() {
        return _isNext.apply(this, arguments);
      }
      return isNext;
    }()
  });
};
exports.sidebarNextDriverFactory = sidebarNextDriverFactory;
//# sourceMappingURL=SidebarNext.uni.driver.js.map