"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
var _react = _interopRequireDefault(require("react"));
var _react2 = require("@storybook/react");
var _EditableTitle = _interopRequireDefault(require("../EditableTitle"));
var _visual = require("../../utils/test-utils/visual");
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/cjs/EditableTitle/test/EditableTitle.visual.jsx",
  _this = void 0;
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
var tests = [{
  describe: 'values',
  its: [{
    it: 'Initial Value',
    props: {
      initialValue: 'Initial Value'
    }
  }, {
    it: 'Default value',
    props: {
      defaultValue: 'default value'
    }
  }, {
    it: 'Default value & Initial value',
    props: {
      defaultValue: 'default value',
      initialValue: 'Initial Value'
    }
  }]
}, {
  describe: 'ellipsis',
  its: [{
    it: 'Initial Value',
    props: {
      initialValue: 'Some Title Some Title Some Title Some Title Some Title Some Title'
    }
  }, {
    it: 'Default value',
    props: {
      defaultValue: 'Some Title Some Title Some Title Some Title Some Title Some Title'
    }
  }]
}];
var interactiveDataHook = 'interactive-editable-title';
var ClickedEditableTitle = /*#__PURE__*/function (_React$Component) {
  function ClickedEditableTitle() {
    (0, _classCallCheck2["default"])(this, ClickedEditableTitle);
    return _callSuper(this, ClickedEditableTitle, arguments);
  }
  (0, _inherits2["default"])(ClickedEditableTitle, _React$Component);
  return (0, _createClass2["default"])(ClickedEditableTitle, [{
    key: "componentDidMount",
    value: function () {
      var _componentDidMount = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee() {
        return _regenerator["default"].wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              (0, _visual.clickElement)(interactiveDataHook);
            case 1:
            case "end":
              return _context.stop();
          }
        }, _callee);
      }));
      function componentDidMount() {
        return _componentDidMount.apply(this, arguments);
      }
      return componentDidMount;
    }()
  }, {
    key: "render",
    value: function render() {
      return /*#__PURE__*/_react["default"].createElement(_EditableTitle["default"], (0, _extends2["default"])({}, this.props, {
        dataHook: interactiveDataHook,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 60,
          columnNumber: 12
        }
      }));
    }
  }]);
}(_react["default"].Component);
var componentsVariations = [{
  testTitle: 'EditableTitle',
  Component: function Component(props) {
    return /*#__PURE__*/_react["default"].createElement(_EditableTitle["default"], (0, _extends2["default"])({}, props, {
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 67,
        columnNumber: 25
      }
    }));
  }
}, {
  testTitle: 'EditableTitle/clicked',
  Component: function Component(props) {
    return /*#__PURE__*/_react["default"].createElement(ClickedEditableTitle, (0, _extends2["default"])({}, props, {
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 71,
        columnNumber: 25
      }
    }));
  }
}];
componentsVariations.forEach(function (_ref) {
  var testTitle = _ref.testTitle,
    Component = _ref.Component;
  tests.forEach(function (_ref2) {
    var describe = _ref2.describe,
      its = _ref2.its;
    its.forEach(function (_ref3) {
      var it = _ref3.it,
        props = _ref3.props;
      (0, _react2.storiesOf)("".concat(testTitle).concat(describe ? '/' + describe : ''), module).add(it, function () {
        return /*#__PURE__*/_react["default"].createElement("div", {
          style: {
            width: '300px'
          },
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 81,
            columnNumber: 11
          }
        }, /*#__PURE__*/_react["default"].createElement(Component, (0, _extends2["default"])({}, props, {
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 82,
            columnNumber: 13
          }
        })));
      });
    });
  });
});