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 Input from '../../../ts/views/inputs/input'; const inputSpy = sinon.spy(); test(' onChange does not get called if disabled', (t) => { const wrapper = shallow( ); wrapper.find('input').simulate('change', {target: {value: 'My new value'}}); t.is(inputSpy.called, false); }); test(' passed in function gets called if not disabled', (t) => { const wrapper = shallow( ); wrapper.find('input').simulate('change', {target: {value: 'My new value'}}); t.is(inputSpy.called, true); }); test(' wrapper and children elements get proper classnames if disabled', (t) => { const wrapper = shallow( ); // Test the wrapper t.is(wrapper.hasClass('input-container disabled'), true); t.is(wrapper.containsMatchingElement(), true); }); test(' wrapper and children elements get proper classnames if NOT disabled', (t) => { const wrapper = shallow( ); t.is(wrapper.hasClass('input-container disabled'), false); t.is(wrapper.containsMatchingElement(), false); });