"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.tagUniDriverFactory = 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 _Tag = require("./Tag.constants");
var _TextUni = require("../Text/Text.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 tagUniDriverFactory = base => {
  var removeButton = base.$("[data-hook=\"".concat(_Tag.dataHooks.removeButton, "\"]"));
  var thumb = base.$("[data-hook=\"".concat(_Tag.dataHooks.thumb, "\"]"));
  var textDriver = (0, _TextUni.textUniDriverFactory)(base.$("[data-hook=\"".concat(_Tag.dataHooks.text, "\"]")));
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base)), {}, {
    isTiny: function () {
      var _isTiny = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SIZE)) === 'tiny';
      });
      function isTiny() {
        return _isTiny.apply(this, arguments);
      }
      return isTiny;
    }(),
    isSmall: function () {
      var _isSmall = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SIZE)) === 'small';
      });
      function isSmall() {
        return _isSmall.apply(this, arguments);
      }
      return isSmall;
    }(),
    isMedium: function () {
      var _isMedium = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SIZE)) === 'medium';
      });
      function isMedium() {
        return _isMedium.apply(this, arguments);
      }
      return isMedium;
    }(),
    isLarge: function () {
      var _isLarge = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SIZE)) === 'large';
      });
      function isLarge() {
        return _isLarge.apply(this, arguments);
      }
      return isLarge;
    }(),
    isStandardTheme: function () {
      var _isStandardTheme = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'standard';
      });
      function isStandardTheme() {
        return _isStandardTheme.apply(this, arguments);
      }
      return isStandardTheme;
    }(),
    isWarningTheme: function () {
      var _isWarningTheme = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'warning';
      });
      function isWarningTheme() {
        return _isWarningTheme.apply(this, arguments);
      }
      return isWarningTheme;
    }(),
    isErrorTheme: function () {
      var _isErrorTheme = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'error';
      });
      function isErrorTheme() {
        return _isErrorTheme.apply(this, arguments);
      }
      return isErrorTheme;
    }(),
    isDarkTheme: function () {
      var _isDarkTheme = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'dark';
      });
      function isDarkTheme() {
        return _isDarkTheme.apply(this, arguments);
      }
      return isDarkTheme;
    }(),
    isSuccessTheme: function () {
      var _isSuccessTheme = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'success';
      });
      function isSuccessTheme() {
        return _isSuccessTheme.apply(this, arguments);
      }
      return isSuccessTheme;
    }(),
    isStandardSkin: function () {
      var _isStandardSkin = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'standard';
      });
      function isStandardSkin() {
        return _isStandardSkin.apply(this, arguments);
      }
      return isStandardSkin;
    }(),
    isWarningSkin: function () {
      var _isWarningSkin = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'warning';
      });
      function isWarningSkin() {
        return _isWarningSkin.apply(this, arguments);
      }
      return isWarningSkin;
    }(),
    isErrorSkin: function () {
      var _isErrorSkin = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'error';
      });
      function isErrorSkin() {
        return _isErrorSkin.apply(this, arguments);
      }
      return isErrorSkin;
    }(),
    isDarkSkin: function () {
      var _isDarkSkin = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'dark';
      });
      function isDarkSkin() {
        return _isDarkSkin.apply(this, arguments);
      }
      return isDarkSkin;
    }(),
    isSuccessSkin: function () {
      var _isSuccessSkin = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.SKIN)) === 'success';
      });
      function isSuccessSkin() {
        return _isSuccessSkin.apply(this, arguments);
      }
      return isSuccessSkin;
    }(),
    isRemovable: function () {
      var _isRemovable = (0, _asyncToGenerator2.default)(function* () {
        return removeButton.exists();
      });
      function isRemovable() {
        return _isRemovable.apply(this, arguments);
      }
      return isRemovable;
    }(),
    removeTag: function () {
      var _removeTag = (0, _asyncToGenerator2.default)(function* () {
        return removeButton.click();
      });
      function removeTag() {
        return _removeTag.apply(this, arguments);
      }
      return removeTag;
    }(),
    click: function () {
      var _click = (0, _asyncToGenerator2.default)(function* () {
        return base.click();
      });
      function click() {
        return _click.apply(this, arguments);
      }
      return click;
    }(),
    isThumbExists: () => thumb.exists(),
    isDisabled: function () {
      var _isDisabled = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.DISABLED)) === 'true';
      });
      function isDisabled() {
        return _isDisabled.apply(this, arguments);
      }
      return isDisabled;
    }(),
    getLabel: function () {
      var _getLabel = (0, _asyncToGenerator2.default)(function* () {
        return base.text();
      });
      function getLabel() {
        return _getLabel.apply(this, arguments);
      }
      return getLabel;
    }(),
    getCloseButtonSkin: function () {
      var _getCloseButtonSkin = (0, _asyncToGenerator2.default)(function* () {
        return yield removeButton.attr('data-skin');
      });
      function getCloseButtonSkin() {
        return _getCloseButtonSkin.apply(this, arguments);
      }
      return getCloseButtonSkin;
    }(),
    getCloseButtonTheme: function () {
      var _getCloseButtonTheme = (0, _asyncToGenerator2.default)(function* () {
        return yield removeButton.attr('data-skin');
      });
      function getCloseButtonTheme() {
        return _getCloseButtonTheme.apply(this, arguments);
      }
      return getCloseButtonTheme;
    }(),
    getCloseButtonSize: function () {
      var _getCloseButtonSize = (0, _asyncToGenerator2.default)(function* () {
        return yield removeButton.attr('data-size');
      });
      function getCloseButtonSize() {
        return _getCloseButtonSize.apply(this, arguments);
      }
      return getCloseButtonSize;
    }(),
    getTextSize: function () {
      var _getTextSize = (0, _asyncToGenerator2.default)(function* () {
        return textDriver.getSize();
      });
      function getTextSize() {
        return _getTextSize.apply(this, arguments);
      }
      return getTextSize;
    }(),
    getTextWeight: function () {
      var _getTextWeight = (0, _asyncToGenerator2.default)(function* () {
        return textDriver.getWeight();
      });
      function getTextWeight() {
        return _getTextWeight.apply(this, arguments);
      }
      return getTextWeight;
    }(),
    isClickable: function () {
      var _isClickable = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.CLICKABLE)) === 'true';
      });
      function isClickable() {
        return _isClickable.apply(this, arguments);
      }
      return isClickable;
    }(),
    isHoverable: function () {
      var _isHoverable = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr(_Tag.dataAttr.HOVERABLE)) === 'true';
      });
      function isHoverable() {
        return _isHoverable.apply(this, arguments);
      }
      return isHoverable;
    }(),
    pressKey: function () {
      var _pressKey = (0, _asyncToGenerator2.default)(function* (key) {
        return removeButton.pressKey(key);
      });
      function pressKey(_x) {
        return _pressKey.apply(this, arguments);
      }
      return pressKey;
    }()
  });
};
exports.tagUniDriverFactory = tagUniDriverFactory;
//# sourceMappingURL=Tag.uni.driver.js.map