import _extends from "@babel/runtime/helpers/extends";
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
import _inherits from "@babel/runtime/helpers/inherits";
var _jsxFileName = "/home/builduser/work/57e038ea7326c1ec/packages/wix-design-system/dist/esm/EditableTitle/test/EditableTitle.visual.jsx",
  _this = this;
import _regeneratorRuntime from "@babel/runtime/regenerator";
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(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; })(); }
import React from 'react';
import { storiesOf } from '@storybook/react';
import EditableTitle from '../EditableTitle';
import { clickElement } from '../../utils/test-utils/visual';
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() {
    _classCallCheck(this, ClickedEditableTitle);
    return _callSuper(this, ClickedEditableTitle, arguments);
  }
  _inherits(ClickedEditableTitle, _React$Component);
  return _createClass(ClickedEditableTitle, [{
    key: "componentDidMount",
    value: function () {
      var _componentDidMount = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
        return _regeneratorRuntime.wrap(function _callee$(_context) {
          while (1) switch (_context.prev = _context.next) {
            case 0:
              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.createElement(EditableTitle, _extends({}, this.props, {
        dataHook: interactiveDataHook,
        __self: this,
        __source: {
          fileName: _jsxFileName,
          lineNumber: 60,
          columnNumber: 12
        }
      }));
    }
  }]);
}(React.Component);
var componentsVariations = [{
  testTitle: 'EditableTitle',
  Component: function Component(props) {
    return /*#__PURE__*/React.createElement(EditableTitle, _extends({}, props, {
      __self: _this,
      __source: {
        fileName: _jsxFileName,
        lineNumber: 67,
        columnNumber: 25
      }
    }));
  }
}, {
  testTitle: 'EditableTitle/clicked',
  Component: function Component(props) {
    return /*#__PURE__*/React.createElement(ClickedEditableTitle, _extends({}, 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;
      storiesOf("".concat(testTitle).concat(describe ? '/' + describe : ''), module).add(it, function () {
        return /*#__PURE__*/React.createElement("div", {
          style: {
            width: '300px'
          },
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 81,
            columnNumber: 11
          }
        }, /*#__PURE__*/React.createElement(Component, _extends({}, props, {
          __self: _this,
          __source: {
            fileName: _jsxFileName,
            lineNumber: 82,
            columnNumber: 13
          }
        })));
      });
    });
  });
});