"use strict";

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

var _enzyme = require("enzyme");

var _ = _interopRequireDefault(require("../"));

var _spotlight = _interopRequireDefault(require("@enact/spotlight"));

var _MoonstoneDecorator = _interopRequireDefault(require("../MoonstoneDecorator.less"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

describe('MoonstoneDecorator', function () {
  var AppRoot = function AppRoot(props) {
    return _react.default.createElement("div", _extends({
      "data-app": true
    }, props));
  };

  it('should add base moonstone classes to wrapped component', function () {
    var config = {
      ri: false,
      i18n: false,
      spotlight: false,
      float: false,
      overlay: false
    };
    var App = (0, _.default)(config, AppRoot);
    var subject = (0, _enzyme.mount)(_react.default.createElement(App, null));

    _spotlight.default.terminate();

    var appRoot = subject.find('[data-app]');
    var expected = true;
    var actual = appRoot.hasClass('moonstone') && appRoot.hasClass(_MoonstoneDecorator.default.bg);
    expect(actual).to.equal(expected);
  });
  it('should add author classes to wrapped component', function () {
    var config = {
      ri: false,
      i18n: false,
      spotlight: false,
      float: false,
      overlay: false
    };
    var App = (0, _.default)(config, AppRoot);
    var subject = (0, _enzyme.mount)(_react.default.createElement(App, {
      className: "author-class"
    }));

    _spotlight.default.terminate();

    var appRoot = subject.find('[data-app]');
    var expected = true;
    var actual = appRoot.hasClass('author-class');
    expect(actual).to.equal(expected);
  });
  it('should not add .moonstone class to wrapped component when float is enabled', function () {
    var config = {
      ri: false,
      i18n: false,
      spotlight: false,
      float: true,
      overlay: false
    };
    var App = (0, _.default)(config, AppRoot);
    var subject = (0, _enzyme.mount)(_react.default.createElement(App, null));

    _spotlight.default.terminate();

    var appRoot = subject.find('[data-app]');
    var expected = false;
    var actual = appRoot.hasClass('moonstone');
    expect(actual).to.equal(expected);
  });
  it('should not add .bg class to wrapped component when overlay is enabled', function () {
    var config = {
      ri: false,
      i18n: false,
      spotlight: false,
      float: false,
      overlay: true
    };
    var App = (0, _.default)(config, AppRoot);
    var subject = (0, _enzyme.mount)(_react.default.createElement(App, null));

    _spotlight.default.terminate();

    var appRoot = subject.find('[data-app]');
    var expected = false;
    var actual = appRoot.hasClass(_MoonstoneDecorator.default.bg);
    expect(actual).to.equal(expected);
  });
});