import React from 'react';
import { create } from 'react-test-renderer';
import { AccordionItem } from './AccordionItem';
var CONTENT_ID = 'test-content';

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

describe('AccordionItem', function () {
  it('should render underlying content when collapsed if not lazy', function () {
    var tree = create(React.createElement(AccordionItem, {
      title: "COLLAPSED"
    }, React.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 = create(React.createElement(AccordionItem, {
      lazy: true,
      title: "COLLAPSED"
    }, React.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 = create(React.createElement(AccordionItem, {
      isExpanded: true,
      title: "EXPANDED"
    }, React.createElement(Content, null)));
    expect(tree.root.findByProps({
      testId: CONTENT_ID
    })).toBeTruthy();
    expect(tree).toMatchSnapshot();
  });
});