UNPKG

@wix/design-system

Version:

@wix/design-system

132 lines 3.49 kB
import _extends from "@babel/runtime/helpers/extends"; var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/TimeInput/test/TimeInput.visual.jsx", _this = this; import React from 'react'; import { snap, story, visualize } from 'storybook-snapper'; import TimeInput from '../TimeInput'; import { Add } from '@wix/wix-ui-icons-common'; import { _12HOUR_TIME_FORMATS, _24HOUR_TIME_FORMATS } from '../constants'; var commonProps = { value: new Date('2021-09-06 12:17:54 GMT+0300') }; var tests = [{ describe: 'time value', its: [{ it: 'default', props: {} }, { it: 'disabled', props: { disabled: true } }, { it: 'readOnly', props: { readOnly: true } }, { it: 'timeStyle: long', props: { timeStyle: 'long' } }] }, { describe: 'suffix/prefix prop', its: [{ it: 'suffix and prefix is set', props: { suffix: /*#__PURE__*/React.createElement(Add, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 45, columnNumber: 19 } }), prefix: 'prefix text' } }] }, { describe: 'hideStatusSuffix', its: [{ it: 'hides status suffix', props: { status: 'error', hideStatusSuffix: true } }] }]; visualize(TimeInput.displayName, function () { tests.forEach(function (_ref) { var describe = _ref.describe, its = _ref.its; story(describe, function () { its.map(function (_ref2) { var it = _ref2.it, props = _ref2.props; return snap(it, function () { return /*#__PURE__*/React.createElement(TimeInput, _extends({}, commonProps, props, { __self: _this, __source: { fileName: _jsxFileName, lineNumber: 69, columnNumber: 24 } })); }); }); }); story('time formats of locale', function () { snap('12hour time format', function () { return /*#__PURE__*/React.createElement("div", { style: { display: 'flex', 'flex-wrap': 'wrap' }, __self: _this, __source: { fileName: _jsxFileName, lineNumber: 75, columnNumber: 9 } }, _12HOUR_TIME_FORMATS.map(function (locale) { return /*#__PURE__*/React.createElement(TimeInput, { locale: locale, value: new Date('2022-10-04 1:00 PM'), __self: _this, __source: { fileName: _jsxFileName, lineNumber: 77, columnNumber: 13 } }); })); }); snap('24hour time format', function () { return /*#__PURE__*/React.createElement("div", { style: { display: 'flex', 'flex-wrap': 'wrap' }, __self: _this, __source: { fileName: _jsxFileName, lineNumber: 82, columnNumber: 9 } }, _24HOUR_TIME_FORMATS.map(function (locale) { return /*#__PURE__*/React.createElement(TimeInput, { locale: locale, value: new Date('2022-10-04 13:00'), __self: _this, __source: { fileName: _jsxFileName, lineNumber: 84, columnNumber: 13 } }); })); }); }); }); });