import { jsx as ___EmotionJSX } from "@emotion/core";

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); }

import React from 'react';
import renderer from 'react-test-renderer';
import { shallow } from 'enzyme';
import Accordion from './index';
var testAccordion = {
  title: ___EmotionJSX("div", null, "title"),
  isOpen: false,
  onClick: function onClick() {},
  children: ___EmotionJSX("div", null, "expansion")
};
describe('<Accordion />', function () {
  test('renders regular accordion', function () {
    var component = renderer.create(___EmotionJSX(Accordion, testAccordion));
    var tree = component.toJSON();
    expect(tree).toMatchSnapshot();
  });
  test('renders no border accordion', function () {
    var component = renderer.create(___EmotionJSX(Accordion, _extends({
      noBorder: true
    }, testAccordion)));
    var tree = component.toJSON();
    expect(tree).toMatchSnapshot();
  });
  test('renders disabled accordion', function () {
    var component = renderer.create(___EmotionJSX(Accordion, _extends({
      disabled: true
    }, testAccordion)));
    var tree = component.toJSON();
    expect(tree).toMatchSnapshot();
  });
  test('invokes onClick when title is clicked', function () {
    var spy = jest.fn();
    var titleIndex = 0;
    var component = shallow(___EmotionJSX(Accordion, _extends({}, testAccordion, {
      onClick: spy
    })));
    var title = component.childAt(titleIndex);
    title.simulate('click');
    expect(spy).toHaveBeenCalled();
  });
});