Skip to content

Instantly share code, notes, and snippets.

@ferfabricio
Last active November 24, 2017 06:03
Show Gist options
  • Save ferfabricio/9d4d253ff00266ef864de47d384d6786 to your computer and use it in GitHub Desktop.
Save ferfabricio/9d4d253ff00266ef864de47d384d6786 to your computer and use it in GitHub Desktop.
Problema ao ler prepareStyles, workaround
import React from 'react'
import { TextField } from 'material-ui'
const Test = () => (
<div>
<TextField />
<TextField />
</div>
);
export default Test;
import React from 'react';
import { shallow } from 'enzyme';
import getMuiTheme from 'material-ui/styles/getMuiTheme';
import Test from './Test';
describe('Account test', () => {
it('Number of inputs presence must be equals 2', () => {
const component = shallow(
<Test />,
{
context: {
muiTheme: getMuiTheme(),
},
childContextTypes: {
muiTheme: PropTypes.object.isRequired,
}
}
);
expect(component.find('TextField').length).toBe(2)
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment