"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.ListItemActionDriverFactory = void 0;
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _ListItemAction = require("./ListItemAction.constants");
var _unidriver = require("../utils/test-utils/unidriver");
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; }
// TODO: Add tooltipTestkitDriver when raising major version.
var ListItemActionDriverFactory = base => {
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base)), {}, {
    isTitleExists: function () {
      var _isTitleExists = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.title).exists();
      });
      function isTitleExists() {
        return _isTitleExists.apply(this, arguments);
      }
      return isTitleExists;
    }(),
    getTitleText: function () {
      var _getTitleText = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.title).text();
      });
      function getTitleText() {
        return _getTitleText.apply(this, arguments);
      }
      return getTitleText;
    }(),
    isPrefixIconExists: function () {
      var _isPrefixIconExists = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.prefixIcon).exists();
      });
      function isPrefixIconExists() {
        return _isPrefixIconExists.apply(this, arguments);
      }
      return isPrefixIconExists;
    }(),
    isSuffixIconExists: function () {
      var _isSuffixIconExists = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.suffixIcon).exists();
      });
      function isSuffixIconExists() {
        return _isSuffixIconExists.apply(this, arguments);
      }
      return isSuffixIconExists;
    }(),
    isSubtitleExists: function () {
      var _isSubtitleExists = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.subtitle).exists();
      });
      function isSubtitleExists() {
        return _isSubtitleExists.apply(this, arguments);
      }
      return isSubtitleExists;
    }(),
    getSubtitleText: function () {
      var _getSubtitleText = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.subtitle).text();
      });
      function getSubtitleText() {
        return _getSubtitleText.apply(this, arguments);
      }
      return getSubtitleText;
    }(),
    isSuffixExists: function () {
      var _isSuffixExists = (0, _asyncToGenerator2.default)(function* () {
        return (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.suffix).exists();
      });
      function isSuffixExists() {
        return _isSuffixExists.apply(this, arguments);
      }
      return isSuffixExists;
    }(),
    getSuffixText: () => (0, _unidriver.findByHook)(base, _ListItemAction.DATA_HOOK.suffix).text(),
    getSkin: () => base.attr('data-skin'),
    isDisabled: function () {
      var _isDisabled = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr('data-disabled')) === 'true';
      });
      function isDisabled() {
        return _isDisabled.apply(this, arguments);
      }
      return isDisabled;
    }(),
    mouseEnter: function () {
      var _mouseEnter = (0, _asyncToGenerator2.default)(function* () {
        return base.mouse.hover();
      });
      function mouseEnter() {
        return _mouseEnter.apply(this, arguments);
      }
      return mouseEnter;
    }(),
    mouseLeave: function () {
      var _mouseLeave = (0, _asyncToGenerator2.default)(function* () {
        return base.mouse.leave();
      });
      function mouseLeave() {
        return _mouseLeave.apply(this, arguments);
      }
      return mouseLeave;
    }()
  });
};
exports.ListItemActionDriverFactory = ListItemActionDriverFactory;
//# sourceMappingURL=ListItemAction.uni.driver.js.map