"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.rangeUniDriverFactory = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _unidriver = require("../utils/test-utils/unidriver");
var _constants = require("./constants");
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 rangeUniDriverFactory = (base, body) => {
  var label = () => (0, _unidriver.findByHook)(base, _constants.DATA_HOOKS.label);
  var input = () => (0, _unidriver.findByHook)(base, _constants.DATA_HOOKS.inputWrapper);
  var firstInput = () => (0, _unidriver.findByHookAtIndex)(base, _constants.DATA_HOOKS.inputElement, 0);
  var lastInput = () => (0, _unidriver.findByHookAtIndex)(base, _constants.DATA_HOOKS.inputElement, 1);
  return _objectSpread(_objectSpread({}, (0, _unidriver.baseUniDriverFactory)(base, body)), {}, {
    /**
     * Gets the input wrapper
     * @returns {Promise<HTMLElement>}
     */
    getInput: () => input,
    /**
     * Clicks on the first input
     * @returns {Promise<void>}
     */
    clickFirstInput: () => firstInput().click(),
    /**
     * Clicks on the last input
     * @returns {Promise<void>}
     */
    clickLastInput: () => lastInput().click(),
    /**
     * Checks if both inputs exist
     * @returns {Promise<boolean>}
     */
    hasInput: () => !!firstInput() && !!lastInput(),
    /**
     * Gets the label
     * @returns {Promise<HTMLElement>}
     */
    getLabel: () => label,
    /**
     * Checks if label exists
     * @returns {Promise<boolean>}
     */
    hasLabel: () => label().exists()
  });
};
exports.rangeUniDriverFactory = rangeUniDriverFactory;
//# sourceMappingURL=Range.uni.driver.js.map