@@ -94,6 +94,58 @@ describe('frint-router-component-handlers › createRouteHandler', function () {
9494 } ) ;
9595 } ) ;
9696
97+ describe ( 'RouteHandler functions properly with render() throughout lifecycle' , function ( ) {
98+ const router = new MemoryRouterService ( ) ;
99+
100+ const component = createComponent ( ) ;
101+ const componentToRender = createComponent ( ) ;
102+
103+ component . props = {
104+ path : '/' ,
105+ exact : true ,
106+ render : function ( ) {
107+ /* istanbul ignore next */
108+ return null ;
109+ }
110+ } ;
111+
112+ const handler = createRouteHandler (
113+ ComponentHandler ,
114+ createTestAppInstance ( router ) ,
115+ component
116+ ) ;
117+
118+ router . push ( '/' ) ;
119+
120+ it ( 'initially component data is set to null' , function ( ) {
121+ component . data = handler . getInitialData ( ) ;
122+
123+ expect ( component . data . component ) . to . be . null ;
124+ } ) ;
125+
126+ it ( 'when component prop is set, component data keeps null value' , function ( ) {
127+ component . props . component = componentToRender ;
128+ handler . propsChange ( component . props , false , false , false ) ;
129+
130+ expect ( component . data . component ) . to . be . null ;
131+ } ) ;
132+
133+ it ( 'when render() prop is removed, component data is equal to component prop' , function ( ) {
134+ component . props . render = undefined ;
135+ handler . propsChange ( component . props , false , false , false ) ;
136+
137+ expect ( component . data . component ) . to . equal ( componentToRender ) ;
138+ } ) ;
139+
140+ it ( 'when render() prop is set and component prop removed, component data equals to null' , function ( ) {
141+ component . props . component = undefined ;
142+ component . props . render = ( ) => null ;
143+ handler . propsChange ( component . props , false , false , false ) ;
144+
145+ expect ( component . data . component ) . to . be . null ;
146+ } ) ;
147+ } ) ;
148+
97149 describe ( 'RouteHandler functions properly with computedMatch throughout lifecycle' , function ( ) {
98150 const router = new MemoryRouterService ( ) ;
99151
0 commit comments