Skip to content

Instantly share code, notes, and snippets.

@oshell
Created November 17, 2019 20:37
Show Gist options
  • Save oshell/826debfe4d014407918c90ca1a75628b to your computer and use it in GitHub Desktop.
Save oshell/826debfe4d014407918c90ca1a75628b to your computer and use it in GitHub Desktop.
sample of shadow rendering and triggering a state change
import React from 'react';
import { shallow } from 'enzyme';
import App from './App';
it('button changes color of box', () => {
const app = shallow(<App />);
expect(app.find('.box').length).toEqual(1);
app.find('button').last().simulate('click');
expect(app.find('.box.red').length).toEqual(1);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment