UNPKG

wix-style-react

Version:
96 lines (81 loc) 2.7 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _Ticker = require("../Input/Ticker/testkit/Ticker"); var _testUtils = _interopRequireDefault(require("react-dom/test-utils")); var _vanilla = require("wix-ui-test-utils/vanilla"); var _Input = _interopRequireDefault(require("../Input/Input.driver")); var _constants = require("./constants"); var inputTestkitFactory = (0, _vanilla.testkitFactoryCreator)(_Input["default"]); var timeInputDriverFactory = function timeInputDriverFactory(_ref) { var element = _ref.element; var input = function input() { return inputTestkitFactory({ wrapper: element, dataHook: _constants.dataHooks.input }); }; var inputTicker = function inputTicker() { return (0, _Ticker.tickerTestkitFactory)({ wrapper: element }); }; var amPmIndicator = function amPmIndicator() { return element.querySelector("[data-hook=\"".concat(_constants.dataHooks.amPmIndicator, "\"]")); }; return { exists: function exists() { return !!element; }, getValue: function getValue() { return input().getValue(); }, isDisabled: function isDisabled() { return input().isDisabled(); }, clickTickerUp: function clickTickerUp() { return inputTicker().clickUp(); }, clickTickerDown: function clickTickerDown() { return inputTicker().clickDown(); }, isAmPmIndicatorExist: function isAmPmIndicatorExist() { return !!amPmIndicator(); }, toggleAmPmIndicator: function toggleAmPmIndicator() { return _testUtils["default"].Simulate.click(amPmIndicator()); }, getAmPmIndicatorText: function getAmPmIndicatorText() { return amPmIndicator().innerHTML; }, getCustomSuffix: function getCustomSuffix() { var customSuffix = element.querySelector("[data-hook=\"".concat(_constants.dataHooks.customSuffix, "\"]")); if (customSuffix) { return customSuffix.innerHTML; } }, isRtl: function isRtl() { return input().isRTL(); }, setValue: function setValue(value) { return input().enterText(value); }, blur: function blur() { return input().blur(); }, hasStatus: function hasStatus(status) { return input().hasStatus(status); }, getStatusMessage: function getStatusMessage() { return input().getStatusMessage(); }, isShowSeconds: function isShowSeconds() { return input().getValue().length === 8; } }; }; var _default = timeInputDriverFactory; exports["default"] = _default;