UNPKG

@wix/design-system

Version:

@wix/design-system

122 lines 3.24 kB
import _extends from "@babel/runtime/helpers/extends"; import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/FunnelChart/test/FunnelChart.visual.jsx", _this = this; import React from 'react'; import { storiesOf } from '@storybook/react'; import { BuildSmall } from '@wix/wix-ui-icons-common'; import FunnelChart from '../FunnelChart'; var commonProps = { data: [{ value: 1000, label: 'visits', displayValue: '1K' }, { value: 800, label: 'views' }, { value: 400, label: 'cart' }] }; var tests = [{ describe: 'sanity', its: [{ it: '3 items', props: { data: commonProps.data } }, { it: '3 items no badges', props: { data: commonProps.data, hideDifferenceBadge: true } }, { it: 'last item value is zero', props: { data: [].concat(_toConsumableArray(commonProps.data), [{ value: 0, label: 'checkout', displayValue: '-' }]) } }, { it: 'dark badges', props: { data: commonProps.data, differenceBadgeSkin: 'dark' } }, { it: 'full height', props: { data: commonProps.data, fullHeight: true } }, { it: '2nd step and its badge have success skin', props: { data: commonProps.data, differenceStepSkin: function differenceStepSkin(_ref) { var currentIndex = _ref.currentIndex; return currentIndex === 1 ? 'success' : 'standard'; }, differenceBadgeProps: function differenceBadgeProps(_ref2) { var currentIndex = _ref2.currentIndex; return { skin: currentIndex === 1 ? 'success' : 'standard' }; } } }, { it: '1st and 3rd steps and their badges have icons', props: { data: [].concat(_toConsumableArray(commonProps.data), [{ value: 350, label: 'checkout', displayValue: '-' }]), differenceBadgeProps: function differenceBadgeProps(_ref3) { var currentIndex = _ref3.currentIndex; return { prefixIcon: currentIndex !== 1 ? /*#__PURE__*/React.createElement(BuildSmall, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 77, columnNumber: 48 } }) : null }; } } }] }]; tests.forEach(function (_ref4) { var describe = _ref4.describe, its = _ref4.its; its.forEach(function (_ref5) { var it = _ref5.it, props = _ref5.props; storiesOf("".concat(FunnelChart.displayName).concat(describe ? '/' + describe : ''), module).add(it, function () { return /*#__PURE__*/React.createElement("div", { style: { height: '250px' }, __self: _this, __source: { fileName: _jsxFileName, lineNumber: 92, columnNumber: 7 } }, /*#__PURE__*/React.createElement(FunnelChart, _extends({}, commonProps, props, { __self: _this, __source: { fileName: _jsxFileName, lineNumber: 93, columnNumber: 9 } }))); }); }); });