UNPKG

@wix/design-system

Version:

@wix/design-system

200 lines 4.37 kB
import _extends from "@babel/runtime/helpers/extends"; var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/ComposerSidebar/test/ComposerSidebar.visual.jsx", _this = this; import React from 'react'; import { storiesOf } from '@storybook/react'; import ComposerSidebar from '../ComposerSidebar'; import * as Icons from '@wix/wix-ui-icons-common'; import { items, itemsWithSections, disabledItems } from '../constants'; var commonProps = { items: items, selectedId: 1 }; var tests = [{ describe: 'size with bottom labelPlacement', its: [{ it: 'medium', props: { size: 'medium', labelPlacement: 'bottom' } }, { it: 'large', props: { size: 'large', labelPlacement: 'bottom' } }, { it: 'small', props: { size: 'small', labelPlacement: 'bottom' } }] }, { describe: 'size', its: [{ it: 'medium', props: { size: 'medium' } }, { it: 'large', props: { size: 'large' } }, { it: 'small', props: { size: 'small' } }] }, { describe: 'labelPlacement', its: [{ it: 'end', props: { labelPlacement: 'end' } }, { it: 'bottom', props: { labelPlacement: 'bottom' } }, { it: 'tooltip', props: { labelPlacement: 'tooltip' } }] }, { describe: 'disabled', its: [{ it: 'true', props: { items: disabledItems } }] }, { describe: 'sections', its: [{ it: 'should put items in sections', props: { items: itemsWithSections } }] }, { describe: 'width', its: [{ it: 'end label placement 300', props: { labelPlacement: 'end', width: 300 } }, { it: 'bottom label placement 300px', props: { labelPlacement: 'bottom', width: '300px' } }, { it: 'tooltip label placement 100%', props: { labelPlacement: 'tooltip', width: '100%' } }] }, { describe: 'ellipsis', its: [{ it: 'false & labelPlacement bottom', props: { ellipsis: false, labelPlacement: 'bottom', items: [{ id: 0, label: 'Very long label that should not be ellipsis', icon: /*#__PURE__*/React.createElement(Icons.CropRotate, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 145, columnNumber: 21 } }) }] } }, { it: 'false & labelPlacement end', props: { ellipsis: false, labelPlacement: 'end', items: [{ id: 0, label: 'Very long label that should not be ellipsis', icon: /*#__PURE__*/React.createElement(Icons.CropRotate, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 159, columnNumber: 21 } }) }] } }, { it: 'true & labelPlacement bottom', props: { ellipsis: true, labelPlacement: 'bottom', items: [{ id: 0, label: 'Very long label that should be ellipsis', icon: /*#__PURE__*/React.createElement(Icons.CropRotate, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 173, columnNumber: 21 } }) }] } }, { it: 'true & labelPlacement end', props: { ellipsis: true, labelPlacement: 'end', items: [{ id: 0, label: 'Very long label that should be ellipsis', icon: /*#__PURE__*/React.createElement(Icons.CropRotate, { __self: this, __source: { fileName: _jsxFileName, lineNumber: 187, columnNumber: 21 } }) }] } }] }]; tests.forEach(function (_ref) { var describe = _ref.describe, its = _ref.its; its.forEach(function (_ref2) { var it = _ref2.it, props = _ref2.props; storiesOf("".concat(ComposerSidebar.displayName).concat(describe ? '/' + describe : ''), module).add(it, function () { return /*#__PURE__*/React.createElement(ComposerSidebar, _extends({}, commonProps, props, { __self: _this, __source: { fileName: _jsxFileName, lineNumber: 201, columnNumber: 21 } })); }); }); });