"use strict";

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

var R = _interopRequireWildcard(require("ramda"));

var _enzyme = _interopRequireWildcard(require("enzyme"));

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

var _enzymeAdapterReact = _interopRequireDefault(require("enzyme-adapter-react-16"));

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }

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

_enzyme.default.configure({
  adapter: new _enzymeAdapterReact.default()
});

describe('BlankSlate Description', function () {
  var el = document.createElement('div');
  document.body.appendChild(el);
  test('should render', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.Description, null, " description "));
    expect(wrapper.find(_.Description).length).toEqual(1);
  });
  test('should contain description text', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.Description, null, "description text"));
    expect(wrapper.find(_.Description).text()).toEqual('description text');
  });
});
describe('BlankSlate PrimaryActionButton', function () {
  var el = document.createElement('div');
  document.body.appendChild(el);
  test('should have a label', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.PrimaryActionButton, {
      label: "a button"
    }));
    var button = wrapper.find(_.PrimaryActionButton);
    expect(button.length).toEqual(1);
    expect(button.text()).toEqual('a button');
  });
  test('should respond to clicks', function () {
    var clickWatcher = {
      clickCount: 0
    };

    var clickHandler = function clickHandler() {
      clickWatcher.clickCount += 1;
    };

    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.PrimaryActionButton, {
      label: "a button",
      handler: clickHandler
    }));
    var button = wrapper.find('button.vs-bs-button-primary');
    button.simulate('click');
    expect(clickWatcher.clickCount).toEqual(1);
  });
});
describe('BlankSlate SecondaryActionButton', function () {
  var el = document.createElement('div');
  document.body.appendChild(el);
  test('should have a label', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.SecondaryActionButton, {
      label: "a button"
    }));
    var button = wrapper.find(_.SecondaryActionButton);
    expect(button.length).toEqual(1);
    expect(button.text()).toEqual('a button');
  });
  test('should respond to clicks', function () {
    var clickWatcher = {
      clickCount: 0
    };

    var clickHandler = function clickHandler() {
      clickWatcher.clickCount += 1;
    };

    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.SecondaryActionButton, {
      label: "a button",
      handler: clickHandler
    }));
    var button = wrapper.find('button');
    button.simulate('click');
    expect(clickWatcher.clickCount).toEqual(1);
  });
});
describe('BlankSlate', function () {
  var el = document.createElement('div');
  document.body.appendChild(el);
  test('should render', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.BlankSlate, {
      title: "title"
    }));
    expect(wrapper.find(_.BlankSlate).length).toEqual(1);
    expect(wrapper.find('.vs-bs-content').length).toEqual(1);
    expect(wrapper.find('.vs-bs-leftalign').length).toEqual(0);
    expect(wrapper.find('.vs-bs-title').length).toEqual(1); // TODO: Figure out why this isn't working ...
    // expect(wrapper.find(<div className="vs-bs-content"><h1 className="vs-bs-title">"You have no content."</h1></div>).length).toEqual(1);
  });
  test('should render left aligned', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.BlankSlate, {
      title: "title",
      alignment: "left-side"
    }));
    expect(wrapper.find(_.BlankSlate).length).toEqual(1);
    expect(wrapper.find('.vs-bs-content').length).toEqual(1);
    expect(wrapper.find('.vs-bs-leftalign').length).toEqual(1);
    expect(wrapper.find('.vs-bs-title').length).toEqual(1); // TODO: Figure out why this isn't working ...
    // expect(wrapper.find(<div className="vs-bs-content"><h1 className="vs-bs-title">"You have no content."</h1></div>).length).toEqual(1);
  });
  test('should render container, image, and title', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.BlankSlate, null));
    expect(wrapper.find('.vs-bs-container').length).toEqual(1);
    expect(wrapper.find('.vs-bs-img').length).toEqual(1);
    expect(wrapper.find('.vs-bs-title').length).toEqual(1); // TODO: Figure out why this isn't working
    // expect(wrapper.find(<h1 className="vs-bs-title">"title"</h1>)).toEqual(1);
  });
  test('should render a primary action button', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.BlankSlate, null, _react.default.createElement(_.PrimaryActionButton, {
      label: "primary button"
    })));
    expect(wrapper.find(_.PrimaryActionButton).length).toEqual(1);
  });
  test('should render a primary action button', function () {
    var wrapper = (0, _enzyme.mount)(_react.default.createElement(_.BlankSlate, null, _react.default.createElement(_.SecondaryActionButton, {
      label: "secondary button"
    })));
    expect(wrapper.find(_.SecondaryActionButton).length).toEqual(1);
  });
});