mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Check for warning when testing to see if error is thrown when render not defined
This commit is contained in:
@@ -55,8 +55,16 @@ describe('ReactES6Class', function() {
|
||||
});
|
||||
|
||||
it('throws if no render function is defined', function() {
|
||||
spyOn(console, 'error');
|
||||
class Foo extends React.Component { }
|
||||
expect(() => React.render(<Foo />, container)).toThrow();
|
||||
expect(console.error.calls[0].args[0]).toBe(
|
||||
'Warning: Foo(...): ' +
|
||||
'No `render` method found on the returned component instance: you may ' +
|
||||
'have forgotten to define `render` in your component or you may have ' +
|
||||
'accidentally tried to render an element whose type is a function that ' +
|
||||
'isn\'t a React component.'
|
||||
);
|
||||
});
|
||||
|
||||
it('renders a simple stateless component with prop', function() {
|
||||
|
||||
Reference in New Issue
Block a user