"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _testUtils = _interopRequireDefault(require("react-dom/test-utils"));
var _Tag = require("./Tag.constants");
var tagDriverFactory = _ref => {
  var {
    element
  } = _ref;
  var getRemoveButton = () => element.querySelector("[data-hook=\"".concat(_Tag.dataHooks.removeButton, "\"]"));
  var getThumb = () => element.querySelector("[data-hook=\"".concat(_Tag.dataHooks.thumb, "\"]"));
  var removeTag = () => {
    var removeButton = getRemoveButton();
    if (removeButton) {
      _testUtils.default.Simulate.click(removeButton);
    }
  };
  return {
    exists: () => !!element,
    isTiny: () => element.getAttribute(_Tag.dataAttr.SIZE) === 'tiny',
    isSmall: () => element.getAttribute(_Tag.dataAttr.SIZE) === 'small',
    isMedium: () => element.getAttribute(_Tag.dataAttr.SIZE) === 'medium',
    isLarge: () => element.getAttribute(_Tag.dataAttr.SIZE) === 'large',
    isStandardTheme: () => element.getAttribute(_Tag.dataAttr.SKIN) === 'standard',
    isWarningTheme: () => element.getAttribute(_Tag.dataAttr.SKIN) === 'warning',
    isErrorTheme: () => element.getAttribute(_Tag.dataAttr.SKIN) === 'error',
    isDarkTheme: () => element.getAttribute(_Tag.dataAttr.SKIN) === 'dark',
    isSuccessTheme: () => element.getAttribute(_Tag.dataAttr.SKIN) === 'success',
    isRemovable: () => !!getRemoveButton(),
    removeTag,
    click: () => _testUtils.default.Simulate.click(element),
    isThumbExists: () => !!getThumb(),
    isDisabled: () => element.getAttribute(_Tag.dataAttr.DISABLED) === 'true',
    getLabel: () => element.textContent
  };
};
var _default = exports.default = tagDriverFactory;
//# sourceMappingURL=Tag.driver.js.map