"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.messageBoxFunctionalLayoutUniDriverFactory = 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 _ButtonUni = require("../Button/Button.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 messageBoxFunctionalLayoutUniDriverFactory = base => {
  var confirmationButton = base.$('[data-hook="confirmation-button"]');
  var cancellationButton = base.$('[data-hook="cancellation-button"]');
  var headerCloseButton = base.$('[data-hook="header-close-button"]');
  var confirmButtonDriver = (0, _ButtonUni.buttonDriverFactory)(confirmationButton);
  var cancelButtonDriver = (0, _ButtonUni.buttonDriverFactory)(cancellationButton);
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base)), {}, {
    exists: () => base.exists(),
    getConfirmationButtonText: () => confirmButtonDriver.getButtonTextContent(),
    isConfirmationButtonPrefixIconExists: function () {
      var _isConfirmationButtonPrefixIconExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield confirmationButton.prop('innerHTML')).indexOf('prefix') !== -1;
      });
      function isConfirmationButtonPrefixIconExists() {
        return _isConfirmationButtonPrefixIconExists.apply(this, arguments);
      }
      return isConfirmationButtonPrefixIconExists;
    }(),
    isConfirmationButtonSuffixIconExists: function () {
      var _isConfirmationButtonSuffixIconExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield confirmationButton.prop('innerHTML')).indexOf('suffix') !== -1;
      });
      function isConfirmationButtonSuffixIconExists() {
        return _isConfirmationButtonSuffixIconExists.apply(this, arguments);
      }
      return isConfirmationButtonSuffixIconExists;
    }(),
    clickOnConfirmationButton: () => confirmButtonDriver.click(),
    getConfirmationButton: () => (0, _unidriver.getElement)(confirmationButton),
    getCancellationButton: () => (0, _unidriver.getElement)(cancellationButton),
    getHeaderCloseButton: () => (0, _unidriver.getElement)(headerCloseButton),
    getCancellationButtonText: () => cancelButtonDriver.getButtonTextContent(),
    isCancellationButtonPrefixIconExists: function () {
      var _isCancellationButtonPrefixIconExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield cancellationButton.prop('innerHTML')).indexOf('prefix') !== -1;
      });
      function isCancellationButtonPrefixIconExists() {
        return _isCancellationButtonPrefixIconExists.apply(this, arguments);
      }
      return isCancellationButtonPrefixIconExists;
    }(),
    isCancellationButtonSuffixIconExists: function () {
      var _isCancellationButtonSuffixIconExists = (0, _asyncToGenerator2.default)(function* () {
        return (yield cancellationButton.prop('innerHTML')).indexOf('suffix') !== -1;
      });
      function isCancellationButtonSuffixIconExists() {
        return _isCancellationButtonSuffixIconExists.apply(this, arguments);
      }
      return isCancellationButtonSuffixIconExists;
    }(),
    clickOnCancellationButton: () => cancelButtonDriver.click(),
    clickOnHeaderCloseButton: () => headerCloseButton.click(),
    isThemeExist: function () {
      var _isThemeExist = (0, _asyncToGenerator2.default)(function* (theme) {
        return (yield base.attr('data-theme')) === theme;
      });
      function isThemeExist(_x) {
        return _isThemeExist.apply(this, arguments);
      }
      return isThemeExist;
    }(),
    getFooter: () => (0, _unidriver.getElement)(base.$('[data-hook="message-box-footer"]')),
    getTitle: () => base.$('[data-hook="header-layout-title"]').text(),
    getChildBySelector: selector => (0, _unidriver.getElement)(base.$(selector)),
    isCancelEnable: () => !cancelButtonDriver.isButtonDisabled(),
    isConfirmationEnable: () => !confirmButtonDriver.isButtonDisabled(),
    toHaveBodyPadding: function () {
      var _toHaveBodyPadding = (0, _asyncToGenerator2.default)(function* () {
        return (yield base.attr('data-nobodypadding')) !== 'true';
      });
      function toHaveBodyPadding() {
        return _toHaveBodyPadding.apply(this, arguments);
      }
      return toHaveBodyPadding;
    }()
  });
};
exports.messageBoxFunctionalLayoutUniDriverFactory = messageBoxFunctionalLayoutUniDriverFactory;
//# sourceMappingURL=MessageBoxFunctionalLayout.uni.driver.js.map