Skip to content

Commit

Permalink
Modified test checking deduplication of 'Functions are not valid as a…
Browse files Browse the repository at this point in the history
… React child' warning so it will check against rerendering component now
  • Loading branch information
Andrey Saleba committed Oct 6, 2017
1 parent 00ca5ee commit 5852b59
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/renderers/__tests__/ReactComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,17 +545,23 @@ describe('ReactComponent', () => {

it('deduplicates function type warnings based on component type', () => {
spyOn(console, 'error');
function Foo() {
return (
<div>
{Foo}{Foo}
<span>{Foo}{Foo}</span>
</div>
);
class Foo extends React.PureComponent {
constructor() {
super();
this.state = {type: 'mushrooms'};
}
render() {
return (
<div>
{Foo}{Foo}
<span>{Foo}{Foo}</span>
</div>
);
}
}
var container = document.createElement('div');
ReactDOM.render(<Foo />, container);

var component = ReactDOM.render(<Foo />, container);
component.setState({type: 'portobello mushrooms'});
expectDev(console.error.calls.count()).toBe(2);
expectDev(normalizeCodeLocInfo(console.error.calls.argsFor(0)[0])).toBe(
'Warning: Functions are not valid as a React child. This may happen if ' +
Expand Down

0 comments on commit 5852b59

Please sign in to comment.