@wix/design-system
Version:
@wix/design-system
270 lines (269 loc) • 5.54 kB
JavaScript
"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 _CircularProgressBar = _interopRequireDefault(require("../CircularProgressBar"));
var _constants = require("../constants");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/CircularProgressBar/test/CircularProgressBar.visual.jsx",
_this = void 0;
var tests = [{
describe: 'basic',
its: [{
it: 'default render',
props: {
value: 20
}
}]
}, {
describe: 'progress indication',
its: [{
it: 'shown',
props: {
value: 20,
showProgressIndication: true
}
}, {
it: 'hidden',
props: {
value: 20
}
}, {
it: 'success icon is shown when progress is 100%',
props: {
value: 100,
showProgressIndication: true
}
}, {
it: 'error icon is shown when there is an error',
props: {
value: 20,
showProgressIndication: true,
error: true,
errorMessage: 'Some error'
}
}]
}, {
describe: 'custom label',
its: [{
it: 'with label',
props: {
label: '1/5',
value: 20
}
}]
}, {
describe: 'theme',
its: [{
it: 'light regular',
props: {
value: 20,
light: true
}
}, {
it: 'light with an error',
props: {
value: 20,
light: true,
error: true
}
}]
}, {
describe: 'error',
its: [{
it: 'exists',
props: {
value: 20,
error: true
}
}, {
it: 'does not exist',
props: {
value: 20,
error: false
}
}, {
it: 'display an error icon',
props: {
value: 20,
showProgressIndication: true,
error: true,
errorMessage: 'Some error'
}
}]
}, {
describe: 'skin',
its: [{
it: 'standard',
props: {
value: 20,
skin: _constants.Skin.standard
}
}, {
it: 'premium',
props: {
value: 20,
skin: _constants.Skin.standard
}
}, {
it: 'success',
props: {
value: 20,
skin: _constants.Skin.success
}
}, {
it: 'standard light',
props: {
value: 20,
skin: _constants.Skin.standard,
light: true
}
}, {
it: 'premium light',
props: {
value: 20,
skin: _constants.Skin.standard,
light: true
}
}, {
it: 'success light',
props: {
value: 20,
skin: _constants.Skin.success,
light: true
}
}]
}, {
describe: 'size',
its: [{
it: 'tiny',
props: {
size: _constants.Size.tiny,
showProgressIndication: true,
value: 20
}
}, {
it: 'small',
props: {
size: _constants.Size.small,
showProgressIndication: true,
value: 20
}
}, {
it: 'medium',
props: {
size: _constants.Size.medium,
showProgressIndication: true,
value: 20
}
}, {
it: 'large',
props: {
size: _constants.Size.large,
showProgressIndication: true,
value: 20
}
}]
}, {
describe: 'label placement',
its: [{
it: 'center with label',
props: {
label: '1/5',
value: 20,
labelPlacement: 'center',
showProgressIndication: true
}
}, {
it: 'center without label',
props: {
value: 20,
labelPlacement: 'center',
showProgressIndication: true
}
}, {
it: 'bottom with label',
props: {
label: '1/5',
value: 20,
labelPlacement: 'bottom',
showProgressIndication: true
}
}, {
it: 'bottom without label',
props: {
value: 20,
labelPlacement: 'bottom',
showProgressIndication: true
}
}]
}, {
describe: 'indicators',
its: [{
it: 'default render',
props: {
size: _constants.Size.tiny,
value: 20
}
}, {
it: 'progress indicator',
props: {
size: _constants.Size.tiny,
value: 20,
showProgressIndication: true
}
}, {
it: 'success icon is shown when progress is 100%',
props: {
size: _constants.Size.tiny,
value: 100,
showProgressIndication: true
}
}, {
it: 'error icon is shown when there is an error',
props: {
size: _constants.Size.tiny,
value: 20,
showProgressIndication: true,
error: true,
errorMessage: 'Some error'
}
}, {
it: 'center label placement not rendered',
props: {
size: _constants.Size.tiny,
label: '1/5',
value: 20,
labelPlacement: 'center',
showProgressIndication: true
}
}]
}];
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)("CircularProgressBar/".concat(describe), module).add(it, function () {
return /*#__PURE__*/_react["default"].createElement("div", {
style: {
width: '40%'
},
__self: _this,
__source: {
fileName: _jsxFileName,
lineNumber: 218,
columnNumber: 7
}
}, /*#__PURE__*/_react["default"].createElement(_CircularProgressBar["default"], (0, _extends2["default"])({}, props, {
__self: _this,
__source: {
fileName: _jsxFileName,
lineNumber: 219,
columnNumber: 9
}
})));
});
});
});