@wix/design-system
Version:
@wix/design-system
119 lines • 2.96 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/FillButton/test/FillButton.visual.jsx",
_this = this;
import React from 'react';
import { storiesOf } from '@storybook/react';
import FillButton from '../FillButton';
import * as Icons from '@wix/wix-ui-icons-common';
import Box from '../../Box';
var commonProps = {
// use for repeated props across the tests (e.g. {buttonText: 'example'})
};
var tests = [{
describe: 'sanity',
its: [{
it: 'default',
// prop variation (e.g. small)
props: {
// the simulation (e.g. {size: "small"})
}
}]
}, {
describe: 'states',
its: [{
it: 'disabled',
// prop variation (e.g. small)
props: {
disabled: true
}
}]
}, {
describe: 'fill',
its: [{
it: 'gradient (contrast dark)',
// prop variation (e.g. small)
props: {
fill: 'linear-gradient(#DBE6B3, #D7E6B3)'
}
}, {
it: 'gradient (contrast white)',
// prop variation (e.g. small)
props: {
fill: 'linear-gradient(#4D4A19, #D7E6B3)'
}
}]
}, {
describe: 'icon',
its: [{
it: 'default icon',
// default icon is an add icon
props: {}
}, {
it: 'edit icon',
// overridden icon
props: {
icon: /*#__PURE__*/React.createElement(Icons.Edit, {
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 61,
columnNumber: 17
}
})
}
}, {
it: 'edit icon small',
// overridden icon size is controlled manually
props: {
icon: /*#__PURE__*/React.createElement(Icons.EditSmall, {
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 67,
columnNumber: 17
}
})
}
}, {
it: 'custom icon with custom fill',
// overridden icon + custom fill
props: {
icon: /*#__PURE__*/React.createElement(Icons.Edit, {
__self: this,
__source: {
fileName: _jsxFileName,
lineNumber: 73,
columnNumber: 17
}
}),
fill: 'linear-gradient(#73d2de, #3399ff)'
}
}]
}];
tests.forEach(function (_ref) {
var describe = _ref.describe,
its = _ref.its;
its.forEach(function (_ref2) {
var it = _ref2.it,
props = _ref2.props;
storiesOf("FillButton".concat(describe ? '/' + describe : ''), module).add(it, function () {
return /*#__PURE__*/React.createElement(Box, {
height: "24px",
padding: "20px",
__self: _this,
__source: {
fileName: _jsxFileName,
lineNumber: 86,
columnNumber: 9
}
}, /*#__PURE__*/React.createElement(FillButton, _extends({}, commonProps, props, {
__self: _this,
__source: {
fileName: _jsxFileName,
lineNumber: 87,
columnNumber: 11
}
})));
});
});
});