import React from 'react';
import { shallow } from 'enzyme';
import { Button as fromLib } from '../../..';
import Button from '..';
var props = {
  text: 'test text'
};
var wrapper;
describe('Button', function () {
  beforeEach(function () {
    wrapper = shallow(React.createElement(Button, props));
  });
  it('should be exported as part of the library', function () {
    expect(fromLib).toEqual(Button);
  });
  it('should render correctly', function () {
    expect(wrapper).toMatchSnapshot();
  });
  it('should allow variants', function () {
    wrapper.setProps({
      variant: 'secondary'
    });
    var className = wrapper.find('button').prop('className');
    expect(className).toMatch(/btn-secondary/);
  });
  it('should attach classNames', function () {
    wrapper.setProps({
      className: 'textClass'
    });
    var className = wrapper.find('button').prop('className');
    expect(className).toMatch(/textClass/);
  });
  it('should allow different tags', function () {
    wrapper.setProps({
      tag: 'a'
    });
    expect(wrapper.find('a').length).toBe(1);
  });
  it('should pass additional props', function () {
    wrapper.setProps({
      id: 'testId',
      type: 'submit'
    });
    var button = wrapper.find('button');
    expect(button.prop('id')).toBe('testId');
    expect(button.prop('type')).toBe('submit');
  });
});