siesta-lite
Version:
Stress-free JavaScript unit testing and functional testing tool, works in NodeJS and browsers
47 lines (38 loc) • 1.22 kB
JavaScript
import 'raf/polyfill';
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import React from 'react';
import renderer from 'react-test-renderer';
import { shallow } from 'enzyme';
import { TextBox } from '../../Components/TextBox';
configure({ adapter: new Adapter() });
describe('TextBox', t => {
let textBoxProps;
t.beforeEach(() => {
textBoxProps = {
fontFamily: "Oswald",
fontVariant: "Regular",
fontSize: "40",
color: {
r: '0',
g: '0',
b: '0',
a: '1',
}
}
})
t.it('renders correctly', t => {
let tree = renderer.create(
<TextBox {...textBoxProps} />
).toJSON();
// expect(tree).toMatchSnapshot();
});
t.it('should toggle isHowToUseTabVisible on how to use btn click', t => {
let wrapper = shallow(<TextBox {...textBoxProps} />);
let elm = wrapper.find('.HowToUse');
elm.simulate("click");
t.ok(wrapper.instance().state.isHowToUseTabVisible)
elm.simulate("click");
t.notOk(wrapper.instance().state.isHowToUseTabVisible)
})
});