"use strict";

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

var _CollapsiblePanel = require("../CollapsiblePanel");

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

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('CollapsiblePanel', function () {
  var shallowWrapper;
  describe('when initially collapsed', function () {
    beforeEach(function () {
      shallowWrapper = (0, _enzyme.shallow)(_react.default.createElement(_CollapsiblePanel.CollapsiblePanel, null, _react.default.createElement("div", {
        id: "test-marker"
      }, "I am some content")));
    });
    test('should not initially show content', function () {
      expect(shallowWrapper.find("div#test-marker").length).toBe(0);
    });
    test('should toggle content when button is clicked', function () {
      var headerButton = shallowWrapper.find('.vs-collapsible-panel-header-button');
      headerButton.simulate('click');
      expect(shallowWrapper.find("div#test-marker").length).toBe(1);
      headerButton.simulate('click');
      expect(shallowWrapper.find("div#test-marker").length).toBe(0);
    });
  });
  describe('when not initially collapsed', function () {
    beforeEach(function () {
      shallowWrapper = (0, _enzyme.shallow)(_react.default.createElement(_CollapsiblePanel.CollapsiblePanel, {
        initializedCollapsed: false
      }, _react.default.createElement("div", {
        id: "test-marker"
      }, "I am some content")));
    });
    test('should initially show the content', function () {
      expect(shallowWrapper.find("div#test-marker").length).toBe(1);
    });
  });
});