UNPKG

@wix/design-system

Version:

@wix/design-system

138 lines 4.44 kB
import _extends from "@babel/runtime/helpers/extends"; import _defineProperty from "@babel/runtime/helpers/defineProperty"; var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/SidebarHeaderNext/test/SidebarHeaderNext.visual.jsx", _this = this; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } import React from 'react'; import SidebarHeaderNext from '../SidebarHeaderNext'; import { SidebarNextContext } from '../../SidebarNext/SidebarNextContext'; import Box from '../../Box'; import { snap, visualize } from 'storybook-snapper'; var tests = [{ describe: 'Title', its: [{ it: 'Should display a title', props: { title: 'Title' } }, { it: 'Should display a title with ellipsis', props: { title: 'This is a very long title which exceeds the maximum width of its container' } }] }, { describe: 'Subtitle', its: [{ it: 'Should display a subtitle', props: { subtitle: 'Subtitle' } }, { it: 'Should display a subtitle with ellipsis', props: { title: 'This is a very long subtitle which exceeds the maximum width of its container' } }] }, { describe: 'Children', its: [{ it: 'Should render the given children below the title and subtitle', props: { title: 'Title', subtitle: 'Subtitle', children: /*#__PURE__*/React.createElement("div", { __self: this, __source: { fileName: _jsxFileName, lineNumber: 53, columnNumber: 21 } }, "Children") } }, { it: 'Should display the given children without title or subtitle', props: { children: /*#__PURE__*/React.createElement("div", { __self: this, __source: { fileName: _jsxFileName, lineNumber: 59, columnNumber: 21 } }, "Children") } }] }, { describe: 'Light skin', its: [{ it: 'Should render with light skin', props: { title: 'Title', subtitle: 'Subtitle', children: /*#__PURE__*/React.createElement("div", { __self: this, __source: { fileName: _jsxFileName, lineNumber: 72, columnNumber: 21 } }, "Children") }, context: { skin: 'light' } }] }]; var defaultContext = { skin: 'dark' }; tests.forEach(function (_ref) { var describe = _ref.describe, its = _ref.its; visualize("SidebarHeaderNext", function () { snap(describe, function () { return /*#__PURE__*/React.createElement(React.Fragment, { __self: _this, __source: { fileName: _jsxFileName, lineNumber: 89, columnNumber: 7 } }, its.map(function (_ref2, id) { var props = _ref2.props, _ref2$context = _ref2.context, context = _ref2$context === void 0 ? {} : _ref2$context; return /*#__PURE__*/React.createElement(Box, { backgroundColor: "D70", width: "228px", key: id, __self: _this, __source: { fileName: _jsxFileName, lineNumber: 91, columnNumber: 11 } }, /*#__PURE__*/React.createElement(SidebarNextContext.Provider, { value: _objectSpread(_objectSpread({}, defaultContext), {}, { context: context }), __self: _this, __source: { fileName: _jsxFileName, lineNumber: 92, columnNumber: 13 } }, /*#__PURE__*/React.createElement(SidebarHeaderNext, _extends({}, props, { __self: _this, __source: { fileName: _jsxFileName, lineNumber: 93, columnNumber: 15 } })))); })); }); }); });