import _extends from "@babel/runtime/helpers/extends";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/VariableInput/test/VariableInput.visual.jsx",
  _this = this;
import React from 'react';
import { storiesOf } from '@storybook/react';
import VariableInput from '../VariableInput';
import { sizeTypes } from '../constants';
import Box from '../../Box';
import FormField from '../../FormField';
var commonProps = {
  variableParser: function variableParser(variable) {
    return variable === 'page.name' ? 'Page name' : false;
  }
};
var tests = [{
  describe: 'sanity',
  its: [{
    it: 'text only',
    props: {
      initialValue: 'hello'
    }
  }, {
    it: 'One variable',
    props: {
      initialValue: 'Welcome to my {{page.name}} '
    }
  }, {
    it: 'Variables and emojis',
    props: {
      initialValue: '/🤔{{page.name}}/🤔{{page.name}}'
    }
  }, {
    it: 'Error indication',
    props: {
      initialValue: 'Welcome to my {{page.name}} ',
      status: 'error'
    }
  }, {
    it: 'Warning indication',
    props: {
      initialValue: 'Welcome to my {{page.name}} ',
      status: 'warning'
    }
  }, {
    it: '3 Row',
    props: {
      initialValue: 'Welcome to my {{page.name}} ',
      rows: 3
    }
  }, {
    it: '3 Row with status',
    props: {
      initialValue: 'Welcome to my {{page.name}} ',
      rows: 3,
      status: 'error'
    }
  }, {
    it: 'Disabled',
    props: {
      initialValue: 'Welcome to my {{page.name}} ',
      disabled: true
    }
  }, {
    it: 'readOnly',
    props: {
      initialValue: 'Welcome to my {{page.name}} ',
      readOnly: true
    }
  }, {
    it: 'placeholder',
    props: {
      placeholder: 'This is a placeholder'
    }
  }, {
    it: 'extremely long placeholder',
    props: {
      placeholder: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged."
    }
  }, {
    it: 'Multiline',
    props: {
      multiline: false,
      initialValue: 'Welcome to {{page.name}} Welcome to {{page.name}} '
    }
  }]
}];
var formFieldStatusTests = [{
  describe: 'Form Field status',
  its: [{
    it: 'Error',
    props: {
      status: 'error',
      statusMessage: 'This is error'
    },
    inputProps: {
      initialValue: 'Welcome to my {{page.name}} '
    }
  }, {
    it: 'Warning',
    props: {
      status: 'warning',
      statusMessage: 'This is warning'
    },
    inputProps: {
      initialValue: 'Welcome to my {{page.name}} '
    }
  }, {
    it: 'Loading',
    props: {
      status: 'loading',
      statusMessage: 'This is loading'
    },
    inputProps: {
      initialValue: 'Welcome to my {{page.name}} '
    }
  }]
}];
formFieldStatusTests.forEach(function (_ref) {
  var describe = _ref.describe,
    its = _ref.its;
  its.forEach(function (_ref2) {
    var it = _ref2.it,
      props = _ref2.props,
      inputProps = _ref2.inputProps;
    storiesOf("VariableInput".concat(describe ? '/' + describe : ''), module).add(it, function () {
      return /*#__PURE__*/React.createElement(Box, {
        direction: "vertical",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 144,
          columnNumber: 9
        }
      }, Object.values(sizeTypes).map(function (size) {
        return /*#__PURE__*/React.createElement(Box, {
          margin: 1,
          width: "330px",
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 146,
            columnNumber: 13
          }
        }, /*#__PURE__*/React.createElement(FormField, _extends({}, props, {
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 147,
            columnNumber: 15
          }
        }), /*#__PURE__*/React.createElement(VariableInput, _extends({}, commonProps, {
          size: size
        }, inputProps, {
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 148,
            columnNumber: 17
          }
        }))));
      }));
    });
  });
});
tests.forEach(function (_ref3) {
  var describe = _ref3.describe,
    its = _ref3.its;
  its.forEach(function (_ref4) {
    var it = _ref4.it,
      props = _ref4.props;
    storiesOf("VariableInput".concat(describe ? '/' + describe : ''), module).add(it, function () {
      return /*#__PURE__*/React.createElement(Box, {
        direction: "vertical",
        __self: _this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 163,
          columnNumber: 9
        }
      }, Object.values(sizeTypes).map(function (size) {
        return /*#__PURE__*/React.createElement(Box, {
          margin: 1,
          width: "330px",
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 165,
            columnNumber: 13
          }
        }, /*#__PURE__*/React.createElement(VariableInput, _extends({}, commonProps, props, {
          size: size,
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 166,
            columnNumber: 15
          }
        })));
      }));
    });
  });
});