"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.tickerTestkitFactory = exports.tickerDriverFactory = exports.componentFactory = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _testUtils = require("react-dom/test-utils");
var _ = _interopRequireDefault(require(".."));
var _InputContext = require("../../InputContext");
var _Ticker = require("../Ticker.constants");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/Input/components/Ticker/testkit/Ticker.jsx",
  _this = void 0;
var tickerDriverFactory = exports.tickerDriverFactory = function tickerDriverFactory(component) {
  var handlers = {
    getUp: function getUp() {
      return component.querySelector("[data-hook=\"".concat(_Ticker.dataHooks.tickerUp, "\"]"));
    },
    getDown: function getDown() {
      return component.querySelector("[data-hook=\"".concat(_Ticker.dataHooks.tickerDown, "\"]"));
    },
    clickUp: function clickUp() {
      return _testUtils.Simulate.click(handlers.getUp());
    },
    clickDown: function clickDown() {
      return _testUtils.Simulate.click(handlers.getDown());
    },
    isUpDisabled: function isUpDisabled() {
      return handlers.getUp().hasAttribute('data-disabled');
    },
    isDownDisabled: function isDownDisabled() {
      return handlers.getDown().hasAttribute('data-disabled');
    },
    exists: function exists() {
      return !!component;
    }
  };
  return handlers;
};
var componentFactory = exports.componentFactory = function componentFactory() {
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  return (0, _testUtils.renderIntoDocument)(/*#__PURE__*/_react["default"].createElement("div", {
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 23,
      columnNumber: 5
    }
  }, /*#__PURE__*/_react["default"].createElement(_InputContext.InputContext.Provider, {
    value: context,
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 24,
      columnNumber: 7
    }
  }, /*#__PURE__*/_react["default"].createElement(_["default"], (0, _extends2["default"])({
    dataHook: "ticker"
  }, props, {
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 25,
      columnNumber: 9
    }
  }))))).childNodes[0];
};
var tickerTestkitFactory = exports.tickerTestkitFactory = function tickerTestkitFactory(_ref) {
  var wrapper = _ref.wrapper;
  return tickerDriverFactory(wrapper.querySelector('[data-hook=ticker]'));
};