"use strict";

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

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

var _reactTestRenderer = require("react-test-renderer");

var _AccordionItem = require("./AccordionItem");

var CONTENT_ID = 'test-content';

var Content = function Content() {
  return _react.default.createElement("div", {
    testId: CONTENT_ID
  }, "CONTENT");
};

describe('AccordionItem', function () {
  it('should render underlying content when collapsed if not lazy', function () {
    var tree = (0, _reactTestRenderer.create)(_react.default.createElement(_AccordionItem.AccordionItem, {
      title: "COLLAPSED"
    }, _react.default.createElement(Content, null)));
    expect(tree.root.findByProps({
      testId: CONTENT_ID
    })).toBeTruthy();
    expect(tree).toMatchSnapshot();
  });
  it('should not render underlying content when collapsed if lazy', function () {
    var tree = (0, _reactTestRenderer.create)(_react.default.createElement(_AccordionItem.AccordionItem, {
      lazy: true,
      title: "COLLAPSED"
    }, _react.default.createElement(Content, null)));
    expect(function () {
      return tree.root.findByProps({
        testId: CONTENT_ID
      });
    }).toThrow();
    expect(tree).toMatchSnapshot();
  });
  it('should render correct layout when expanded', function () {
    var tree = (0, _reactTestRenderer.create)(_react.default.createElement(_AccordionItem.AccordionItem, {
      isExpanded: true,
      title: "EXPANDED"
    }, _react.default.createElement(Content, null)));
    expect(tree.root.findByProps({
      testId: CONTENT_ID
    })).toBeTruthy();
    expect(tree).toMatchSnapshot();
  });
});