UNPKG

@wix/design-system

Version:

@wix/design-system

187 lines (186 loc) 4.56 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); var _react = _interopRequireDefault(require("react")); var _react2 = require("@storybook/react"); var _BarChart = _interopRequireDefault(require("../BarChart")); var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/BarChart/test/BarChart.visual.jsx", _this = void 0; var tests = [{ describe: 'sanity', its: [{ it: 'many items', props: { items: [1, 2, 3, 4, 5, 6, 7, 8, 9].map(function (n) { return { value: 250, description: "Option ".concat(n) }; }) } }, { it: '3 items', props: { items: [{ value: 75000, description: 'Facebook' }, { value: 175000, description: 'Instagram' }, { value: 40000, description: 'Pinterest' }] } }, { it: 'label', props: { items: [{ value: 75000, label: '$75,000', description: 'Facebook' }, { value: 175000, label: '$175,000', description: 'Instagram' }, { value: 40000, label: '$40,000', description: 'Pinterest' }] } }] }, { describe: 'total', its: [{ it: '2 item', props: { total: 1200, items: [{ value: 250, description: 'Desktop', descriptionInfo: '250 of 1200 users visiting site from a desktop' }, { value: 480, description: 'Mobile', descriptionInfo: '250 of 1200 users visiting site from mobile' }] } }, { it: '1 item', props: { total: 1200, items: [{ value: 1000, description: 'Desktop', descriptionInfo: '250 of 1200 users visiting site from a desktop' }] } }] }, { describe: 'displayed value', its: [{ it: 'label', props: { items: [{ value: 25000, label: '$25,000', description: 'Sales' }, { value: 48000, label: '$48,000', description: 'Subscription' }, { value: 42000, label: '$42,000', description: 'Ads' }] } }, { it: 'short label', props: { items: [{ value: 25000000, label: '$25,000,000', description: 'Sales' }, { value: 20000000, label: '$20,000,000', labelShort: '$20M', description: 'Subscription' }, { value: 42000000, label: '$42,000,000', labelShort: '$42M', description: 'Ads' }, { value: 78000000, label: '$78,000,000', labelShort: '$78M', description: 'Other' }] } }, { it: 'short label with descriptionInfo', props: { items: [{ value: 25000000, label: '$25,000,000', description: 'Sales', descriptionInfo: 'descriptionInfo' }, { value: 20000000, label: '$20,000,000', labelShort: '$20M', description: 'Subscription', descriptionInfo: 'descriptionInfo' }, { value: 5000000, label: '$5,000,000', labelShort: '$5M', description: 'Donations', descriptionInfo: 'descriptionInfo' }, { value: 42000000, label: '$42,000,000', labelShort: '$42M', description: 'Ads', descriptionInfo: 'descriptionInfo' }, { value: 78000000, label: '$78,000,000', labelShort: '$78M', description: 'Other', descriptionInfo: 'descriptionInfo' }] } }] }]; tests.forEach(function (_ref) { var describe = _ref.describe, its = _ref.its; its.forEach(function (_ref2) { var it = _ref2.it, props = _ref2.props; (0, _react2.storiesOf)("BarChart".concat(describe ? '/' + describe : ''), module).add(it, function () { return /*#__PURE__*/_react["default"].createElement("div", { style: { width: '800px' }, __self: _this, __source: { fileName: _jsxFileName, lineNumber: 202, columnNumber: 9 } }, /*#__PURE__*/_react["default"].createElement(_BarChart["default"], (0, _extends2["default"])({}, props, { __self: _this, __source: { fileName: _jsxFileName, lineNumber: 203, columnNumber: 11 } }))); }); }); });