@wix/design-system
Version:
@wix/design-system
128 lines (127 loc) • 2.99 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _react = _interopRequireDefault(require("react"));
var _storybookSnapper = require("storybook-snapper");
var _AvatarGroup = _interopRequireDefault(require("../AvatarGroup"));
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/AvatarGroup/test/AvatarGroup.visual.jsx",
_this = void 0;
var commonProps = {
items: [{
name: 'first user',
color: 'A1'
}, {
name: 'second user',
color: 'A2'
}, {
name: 'third avatar',
color: 'A3'
}, {
name: 'fourth avatar',
color: 'A4'
}, {
name: 'fifth avatar',
color: 'A5'
}, {
name: 'sixth avatar',
color: 'A6'
}, {
name: 'seventh avatar',
color: 'A1'
}, {
name: 'eighth avatar',
color: 'A2'
}, {
name: 'ninth avatar',
color: 'A3'
}]
// use for repeated props across the tests (e.g. {buttonText: 'example'})
};
var tests = [{
describe: 'sanity',
// prop name (e.g. size)
its: [{
it: 'default',
// prop variation (e.g. small)
props: {}
}]
}, {
describe: 'divider',
its: [{
it: 'should render with divider',
props: {
showDivider: true
}
}, {
it: 'should render with divider with condensed grouping',
props: {
type: 'condensed',
showDivider: true
}
}, {
it: 'should not render if has less than two avatar',
props: {
showDivider: true,
items: [{
name: 'first user',
color: 'A1'
}]
}
}]
}, {
describe: 'size',
its: [{
it: 'should render as medium by default',
props: {}
}, {
it: 'should render as medium by prop',
props: {
size: 'medium'
}
}, {
it: 'should render as small',
props: {
size: 'small'
}
}, {
it: 'should render as tiny',
props: {
size: 'tiny'
}
}]
}, {
describe: 'grouping type',
its: [{
it: 'should render as condensed grouping',
props: {
type: 'condensed'
}
}, {
it: 'should render as stretched grouping',
props: {
type: 'stretched'
}
}]
}];
(0, _storybookSnapper.visualize)(_AvatarGroup["default"].displayName, function () {
tests.forEach(function (_ref) {
var describe = _ref.describe,
its = _ref.its;
(0, _storybookSnapper.story)(describe, function () {
its.map(function (_ref2) {
var it = _ref2.it,
props = _ref2.props;
return (0, _storybookSnapper.snap)(it, function () {
return /*#__PURE__*/_react["default"].createElement(_AvatarGroup["default"], (0, _extends2["default"])({}, commonProps, props, {
__self: _this,
__source: {
fileName: _jsxFileName,
lineNumber: 105,
columnNumber: 24
}
}));
});
});
});
});
});