import React from 'react';
import { shallow } from 'enzyme';
import Button from '../../Button';
import { Panel as fromLib } from '../../..';
import Panel from '..';
var props = {
  title: 'test title',
  children: React.createElement("p", null, "panel content")
};
var wrapper;
describe('Panel', function () {
  beforeEach(function () {
    wrapper = shallow(React.createElement(Panel, props));
  });
  it('should be exported as part of the library', function () {
    expect(fromLib).toEqual(Panel);
  });
  it('should render correctly', function () {
    expect(wrapper).toMatchSnapshot();
  });
  it('should allow variants', function () {
    wrapper.setProps({
      variant: 'standout'
    });
    var className = wrapper.prop('className');
    expect(className).toMatch(/panel-standout/);
  });
  it('should attach classNames', function () {
    wrapper.setProps({
      className: 'textClass'
    });
    var className = wrapper.prop('className');
    expect(className).toMatch(/textClass/);
  });
  it('should pass additional props', function () {
    wrapper.setProps({
      id: 'testId'
    });
    expect(wrapper.prop('id')).toBe('testId');
  });
  it('should attach an icon to the header if provided one', function () {
    wrapper.setProps({
      icon: 'test-icon'
    });
    var iconClass = wrapper.find('h2').find('span').prop('className');
    expect(iconClass).toMatch(/test-icon/);
  });
  it('should attach a button if provided props', function () {
    wrapper.setProps({
      buttonProps: {
        text: 'test-button'
      }
    });
    var buttonText = wrapper.find(Button).prop('text');
    expect(buttonText).toBe('test-button');
  });
});