@@ -24,6 +24,7 @@ var mocks = require('mocks');
2424describe ( 'ReactMount' , function ( ) {
2525 var React = require ( 'React' ) ;
2626 var ReactMount = require ( 'ReactMount' ) ;
27+ var ReactTestUtils = require ( 'ReactTestUtils' ) ;
2728
2829 describe ( 'constructAndRenderComponentByID' , function ( ) {
2930 it ( 'throws if given an id for a component that doesn\'t exist' , function ( ) {
@@ -37,6 +38,29 @@ describe('ReactMount', function() {
3738 } ) ;
3839 } ) ;
3940
41+ it ( 'throws when given a factory' , function ( ) {
42+ expect ( function ( ) {
43+ ReactTestUtils . renderIntoDocument ( React . DOM . div ) ;
44+ } ) . toThrow (
45+ 'Invariant Violation: renderComponent(): Invalid component descriptor. ' +
46+ 'Instead of passing a component class, make sure to instantiate it ' +
47+ 'first by calling it with props.'
48+ ) ;
49+
50+ var Component = React . createClass ( {
51+ render : function ( ) {
52+ return < div /> ;
53+ }
54+ } ) ;
55+ expect ( function ( ) {
56+ ReactTestUtils . renderIntoDocument ( Component ) ;
57+ } ) . toThrow (
58+ 'Invariant Violation: renderComponent(): Invalid component descriptor. ' +
59+ 'Instead of passing a component class, make sure to instantiate it ' +
60+ 'first by calling it with props.'
61+ ) ;
62+ } ) ;
63+
4064 it ( 'should render different components in same root' , function ( ) {
4165 var container = document . createElement ( 'container' ) ;
4266 document . documentElement . appendChild ( container ) ;
0 commit comments