"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _react = _interopRequireDefault(require("react"));

var _enzyme = require("enzyme");

var _ = require("./");

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }

describe('BEM Utils', function () {
  var TestComponent = /*#__PURE__*/function (_Component) {
    (0, _inherits2["default"])(TestComponent, _Component);

    var _super = _createSuper(TestComponent);

    function TestComponent(props) {
      (0, _classCallCheck2["default"])(this, TestComponent);
      return _super.call(this, props, 'TestComponent');
    }

    (0, _createClass2["default"])(TestComponent, [{
      key: "render",
      value: function render() {
        return /*#__PURE__*/_react["default"].createElement("p", {
          className: this.bem.classes()
        }, "Hello ", this.name);
      }
    }]);
    return TestComponent;
  }(_.Component);

  it('BEM component should take an array as a parameter', function () {
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(TestComponent, {
      bem: [['test']]
    }));
    expect(node.getDOMNode().classList).toContain('TestComponent_test');
  });
  it('BEM component should take a string as a parameter', function () {
    var node = (0, _enzyme.mount)( /*#__PURE__*/_react["default"].createElement(TestComponent, {
      bem: "test"
    }));
    expect(node.getDOMNode().classList).toContain('TestComponent-test');
  });
});