import React from 'react';
import { mount } from 'enzyme';
import { Toggle } from '../src';
const Example = () => (
Click this to swap the content
Click the toggle above to turn it on!
Toggle is now on!
this is rendered too
);
test('should render with the off div', () => {
const wrapper = mount();
expect(
wrapper
.find('div')
.last()
.props().children
).toEqual('Click the toggle above to turn it on!');
expect(wrapper.find('p').props().children).toEqual('this is rendered too');
});
test('should render with the off div', () => {
const wrapper = mount();
wrapper
.find('div')
.first()
.simulate('click');
expect(
wrapper
.find('div')
.last()
.props().children
).toEqual('Toggle is now on!');
});