import * as React from 'react';
import * as ReactDOM from 'react-dom';
import test from 'ava';
import * as sinon from 'sinon';
import { shallow, mount } from 'enzyme';
import FileButton from '../../../ts/views/buttons/file-button';
// I'm just doing this to make sure they're calling when NOT disabled too
test(' functions work properly', (t) => {
const onClickSpy = sinon.spy();
const onChangeSpy = sinon.spy();
const wrapper = shallow(
{'test upload'}
);
wrapper.find('input').simulate('change', {target: {file: 'some/file/path'}});
wrapper.find('input').simulate('click');
t.is(onChangeSpy.called, true);
t.is(onClickSpy.called, true);
});
test(' gets proper classnames if disabled', (t) => {
const wrapper = shallow(
{'test upload'}
);
t.is(wrapper.hasClass('file-button disabled'), true);
t.is(wrapper.containsMatchingElement(), true);
});
test(' functions do not get called if disabled', (t) => {
const onChangeSpy = sinon.spy();
const onClickSpy = sinon.spy();
const wrapper = shallow(
);
wrapper.find('input').simulate('change', {target: {file: 'some/file/path'}});
wrapper.find('input').simulate('click');
t.is(onChangeSpy.called, false);
t.is(onClickSpy.called, false);
});