@@ -87,59 +87,31 @@ describe('ReactTestUtils', function() {
8787 expect ( componentWillUnmount ) . toBeCalled ( ) ;
8888 } ) ;
8989
90- it ( 'should run all lifecycle methods' , function ( ) {
91- var componentWillMount = jest . genMockFn ( ) ;
92- var componentDidMount = jest . genMockFn ( ) ;
93- var componentWillReceiveProps = jest . genMockFn ( ) ;
94- var shouldComponentUpdate = jest . genMockFn ( ) ;
95- var componentWillUpdate = jest . genMockFn ( ) ;
96- var componentDidUpdate = jest . genMockFn ( ) ;
97- var componentWillUnmount = jest . genMockFn ( ) ;
98-
90+ it ( 'can shallow render to null' , function ( ) {
9991 var SomeComponent = React . createClass ( {
10092 render : function ( ) {
101- return < SomeComponent onChange = { ( ) => this . setState ( { a : 1 } ) } /> ;
102- } ,
103- componentWillMount,
104- componentDidMount,
105- componentWillReceiveProps,
106- shouldComponentUpdate ( ) {
107- shouldComponentUpdate ( ) ;
108- return true ;
93+ return null ;
10994 } ,
110- componentWillUpdate,
111- componentDidUpdate,
112- componentWillUnmount,
11395 } ) ;
11496
11597 var shallowRenderer = ReactTestUtils . createRenderer ( ) ;
11698 shallowRenderer . render ( < SomeComponent /> ) ;
117- shallowRenderer . getRenderOutput ( ) . props . onChange ( ) ;
118- shallowRenderer . render ( < SomeComponent /> ) ;
119- shallowRenderer . unmount ( ) ;
12099
121- expect ( componentWillMount ) . toBeCalled ( ) ;
122- expect ( componentDidMount ) . toBeCalled ( ) ;
123- expect ( componentWillReceiveProps ) . toBeCalled ( ) ;
124- expect ( shouldComponentUpdate ) . toBeCalled ( ) ;
125- expect ( componentWillUpdate ) . toBeCalled ( ) ;
126- expect ( componentDidUpdate ) . toBeCalled ( ) ;
127- expect ( componentWillUnmount ) . toBeCalled ( ) ;
100+ var result = shallowRenderer . getRenderOutput ( ) ;
101+
102+ expect ( result ) . toBe ( null ) ;
128103 } ) ;
129104
130- it ( 'can shallow render to null ' , function ( ) {
105+ it ( 'can shallow render with a ref ' , function ( ) {
131106 var SomeComponent = React . createClass ( {
132107 render : function ( ) {
133- return null ;
108+ return < div ref = "hello" /> ;
134109 } ,
135110 } ) ;
136111
137112 var shallowRenderer = ReactTestUtils . createRenderer ( ) ;
113+ // Shouldn't crash.
138114 shallowRenderer . render ( < SomeComponent /> ) ;
139-
140- var result = shallowRenderer . getRenderOutput ( ) ;
141-
142- expect ( result ) . toBe ( null ) ;
143115 } ) ;
144116
145117 it ( 'lets you update shallowly rendered components' , function ( ) {
0 commit comments