@wix/design-system
Version:
@wix/design-system
125 lines • 2.68 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/AvatarGroup/test/AvatarGroup.visual.jsx",
_this = this;
import React from 'react';
import { snap, story, visualize } from 'storybook-snapper';
import AvatarGroup from '../AvatarGroup';
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'
}
}]
}];
visualize(AvatarGroup.displayName, function () {
tests.forEach(function (_ref) {
var describe = _ref.describe,
its = _ref.its;
story(describe, function () {
its.map(function (_ref2) {
var it = _ref2.it,
props = _ref2.props;
return snap(it, function () {
return /*#__PURE__*/React.createElement(AvatarGroup, _extends({}, commonProps, props, {
__self: _this,
__source: {
fileName: _jsxFileName,
lineNumber: 105,
columnNumber: 24
}
}));
});
});
});
});
});