"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
var _react = _interopRequireDefault(require("react"));
var _storybookSnapper = require("storybook-snapper");
var _ = _interopRequireDefault(require(".."));
var _FormField = _interopRequireDefault(require("../../FormField"));
var _excluded = ["onDone"];
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/ImageViewer/test/ImageViewer.visual.jsx",
  _this = void 0;
var imageUrl = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAACTklEQVR4Xu2dMW4bQRTFonPkHCly/8JFzuFzxIhLCcgnBvuJtUHXnHkrUpAKFX68//7190d/tzHwKMhtWnw+SEHu1aMgN+vxGuTn25/H3R7yOz/P81fGy0dWQdz8BXF9j2sFGRW5QEFc3+NaQUZFLlAQ1/e4VpBRkQsUxPU9rhVkVOQCBXF9j2sFGRW5QEFc3+NaQUZFLlAQ1/e4VpBRkQsUxPU9rmlBvvNv9Vf+ZlSQ8T07AwWZHalEQVTd89iXDDK/rGuI58/gK2Vd84T/v0X7DjFezL+Nglim4U5BoCgLK4hlGu4UBIqysIJYpuFOQaAoCyuIZRruFASKsrCCWKbhTkGgKAsriGUa7hQEirKwglim4U5BoCgLK4hlGu4UBIqysIJYpuFOQaAoCyuIZRruFASKsrCCWKbhTkGgKAsriGUa7hQEirKwglim4U5BoCgLK4hlGu4UBIqysIJYpuFOQaAoCyuIZRruFASKsrCCWKbhTkGgKAsriGUa7hQEirKwglim4U5BoCgLK4hlGu4UBIqysIJYpuFOQaAoCyuIZRruFASKsrCCWKbhTkGgKAsriGUa7hQEirKwglim4U5BoCgLK4hlGu4UBIqysIJYpuFOQaCoMGbg+Q3V/8Jl3taogqypPbu4IGfe1k4VZE3t2cUFOfO2dqoga2rPLi7Imbe1UwVZU3t2cUHOvK2dKsia2rOLC3Lmbe1UQdbUnl1ckDNva6cKsqb27OKCnHlbOzUGWVvuYmTg5fcQdCpozUBB1tSeXVyQM29rpz4AiuhEmroNH+YAAAAASUVORK5CYII=';
var tests = [{
  description: 'standard',
  its: [{
    it: 'disabled with an image',
    props: {
      imageUrl: imageUrl,
      disabled: true
    }
  }, {
    it: 'disabled without an image',
    props: {
      disabled: true
    }
  }, {
    it: 'loading state (add image should not be visible)',
    props: {
      imageUrl: imageUrl
    },
    skipDone: true
  }]
}, {
  description: 'with status',
  its: [{
    it: 'error',
    props: {
      status: 'error'
    }
  }, {
    it: 'warning',
    props: {
      status: 'warning'
    }
  }, {
    it: 'loading',
    props: {
      status: 'loading'
    }
  }, {
    it: 'disabled with a status',
    props: {
      status: 'error',
      disabled: true
    }
  }]
}, {
  description: 'with fit',
  its: [{
    it: 'cover',
    props: {
      imageUrl: imageUrl,
      fit: 'cover'
    }
  }, {
    it: 'contain',
    props: {
      imageUrl: imageUrl,
      fit: 'contain'
    }
  }]
}];
var formFieldStatusTests = [{
  description: 'Form field status',
  its: [{
    it: 'Error',
    props: {
      status: 'error',
      statusMessage: 'This is error'
    }
  }, {
    it: 'Warning',
    props: {
      status: 'warning',
      statusMessage: 'This is warning'
    }
  }, {
    it: 'Loading',
    props: {
      status: 'loading',
      statusMessage: 'This is loading'
    }
  }]
}];
var AsyncStoryWrapper = function AsyncStoryWrapper(_ref) {
  var onDone = _ref.onDone,
    rest = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
  return /*#__PURE__*/_react["default"].createElement(_["default"], (0, _extends2["default"])({
    onImageLoad: onDone
  }, rest, {
    __self: _this,
    __source: {
      fileName: _jsxFileName,
      lineNumber: 116,
      columnNumber: 3
    }
  }));
};
(0, _storybookSnapper.visualize)('ImageViewer', function () {
  tests.forEach(function (_ref2) {
    var description = _ref2.description,
      its = _ref2.its;
    (0, _storybookSnapper.story)(description, function () {
      its.forEach(function (_ref3) {
        var it = _ref3.it,
          props = _ref3.props,
          skipDone = _ref3.skipDone;
        return skipDone ? (0, _storybookSnapper.snap)(it, function () {
          return /*#__PURE__*/_react["default"].createElement(_["default"], (0, _extends2["default"])({}, props, {
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 124,
              columnNumber: 28
            }
          }));
        }) : (0, _storybookSnapper.snap)(it, function (done) {
          return /*#__PURE__*/_react["default"].createElement(AsyncStoryWrapper, (0, _extends2["default"])({}, props, {
            onDone: done,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 125,
              columnNumber: 30
            }
          }));
        });
      });
    });
  });
});
(0, _storybookSnapper.visualize)('ImageViewer', function () {
  formFieldStatusTests.forEach(function (_ref4) {
    var description = _ref4.description,
      its = _ref4.its;
    (0, _storybookSnapper.story)(description, function () {
      its.forEach(function (_ref5) {
        var it = _ref5.it,
          props = _ref5.props;
        return (0, _storybookSnapper.snap)(it, function (done) {
          return /*#__PURE__*/_react["default"].createElement(_FormField["default"], (0, _extends2["default"])({}, props, {
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 136,
              columnNumber: 11
            }
          }), /*#__PURE__*/_react["default"].createElement(_["default"], {
            onImageLoad: done,
            __self: _this,
            __source: {
              fileName: _jsxFileName,
              lineNumber: 137,
              columnNumber: 13
            }
          }));
        });
      });
    });
  });
});