import React from 'react'; // eslint-disable-line no-unused-vars
import { mount, shallow } from 'enzyme';

const Icon = require('../Icon');
const SimpleInput = require('../SimpleInput');

describe('SimpleInput', () => {
  it('should render a input', () => {
    const wrapper = shallow(<SimpleInput />);

    expect(wrapper.find('input')).toHaveLength(1);
  });

  it('should render a prefix to the left of the input if prop provided', () => {
    const wrapper = shallow(<SimpleInput prefix={(<span>Prefix</span>)} />);

    expect(wrapper.children().first().html()).toEqual('<span>Prefix</span>');
  });

  it('should render a suffix to the right of the input if prop provided', () => {
    const wrapper = shallow(<SimpleInput suffix={(<span>Suffix</span>)} />);

    expect(wrapper.children().last().html()).toEqual('<span>Suffix</span>');
  });

  it('should render a icon to the left of the input if icon prop provided', () => {
    const wrapper = shallow(<SimpleInput icon='cash' />);

    expect(wrapper.children().first().type()).toEqual(Icon);
  });

  it('should render a icon to the right of the input if rightIcon prop provided', () => {
    const wrapper = shallow(<SimpleInput rightIcon='cash' />);

    expect(wrapper.children().last().type()).toEqual(Icon);
  });

  it('should provide a ref to the input via the elementRef prop', () => {
    let inputRef;

    const wrapper = mount(<SimpleInput elementRef={ref => inputRef = ref} />);

    expect(inputRef).toEqual(wrapper.instance().elementRef);
  });
});

@@ -76,17 +76,8 @@
 ount
-, shallow
  %7D f
@@ -254,39 +254,37 @@
 const wrapper = 
-shallow
+mount
 (%3CSimpleInput /%3E
@@ -438,39 +438,37 @@
 const wrapper = 
-shallow
+mount
 (%3CSimpleInput pr
@@ -505,38 +505,89 @@
 %3E);%0A
-%0A
     
-expect(wrapper.children()
+const children = wrapper.find('div').first().children();%0A%0A    expect(children
 .fir
@@ -732,39 +732,37 @@
 const wrapper = 
-shallow
+mount
 (%3CSimpleInput su
@@ -799,38 +799,89 @@
 %3E);%0A
-%0A
     
-expect(wrapper.children()
+const children = wrapper.find('div').first().children();%0A%0A    expect(children
 .las
@@ -1027,39 +1027,37 @@
 const wrapper = 
-shallow
+mount
 (%3CSimpleInput ic
@@ -1075,38 +1075,89 @@
 %3E);%0A
-%0A
     
-expect(wrapper.children()
+const children = wrapper.find('div').first().children();%0A%0A    expect(children
 .fir
@@ -1305,15 +1305,13 @@
 r = 
-shallow
+mount
 (%3CSi
@@ -1346,38 +1346,89 @@
 %3E);%0A
-%0A
     
-expect(wrapper.children()
+const children = wrapper.find('div').first().children();%0A%0A    expect(children
 .las
@@ -1675,29 +1675,32 @@
 per.
-instance().elementRef
+find('input').instance()
 );%0A 

Update tests since SimpleInput is now wrapped by withTheme()