@@ -116,8 +116,8 @@ describe('Modal', () => {
116116 wrapper . unmount ( ) ;
117117 } ) ;
118118
119- it ( 'should not call handleProps when isOpen does not change' , ( ) => {
120- spyOn ( Modal . prototype , 'handleProps ' ) . and . callThrough ( ) ;
119+ it ( 'should not call togglePortal when isOpen does not change' , ( ) => {
120+ spyOn ( Modal . prototype , 'togglePortal ' ) . and . callThrough ( ) ;
121121 spyOn ( Modal . prototype , 'componentDidUpdate' ) . and . callThrough ( ) ;
122122 const wrapper = mount (
123123 < Modal isOpen = { isOpen } toggle = { toggle } >
@@ -127,7 +127,7 @@ describe('Modal', () => {
127127
128128 jasmine . clock ( ) . tick ( 300 ) ;
129129 expect ( isOpen ) . toBe ( false ) ;
130- expect ( Modal . prototype . handleProps ) . not . toHaveBeenCalled ( ) ;
130+ expect ( Modal . prototype . togglePortal ) . not . toHaveBeenCalled ( ) ;
131131 expect ( Modal . prototype . componentDidUpdate ) . not . toHaveBeenCalled ( ) ;
132132
133133 wrapper . setProps ( {
@@ -136,12 +136,39 @@ describe('Modal', () => {
136136 jasmine . clock ( ) . tick ( 300 ) ;
137137
138138 expect ( isOpen ) . toBe ( false ) ;
139- expect ( Modal . prototype . handleProps ) . not . toHaveBeenCalled ( ) ;
139+ expect ( Modal . prototype . togglePortal ) . not . toHaveBeenCalled ( ) ;
140140 expect ( Modal . prototype . componentDidUpdate ) . toHaveBeenCalled ( ) ;
141141
142142 wrapper . unmount ( ) ;
143143 } ) ;
144144
145+ it ( 'should renderIntoSubtree when props updated' , ( ) => {
146+ isOpen = true ;
147+ spyOn ( Modal . prototype , 'togglePortal' ) . and . callThrough ( ) ;
148+ spyOn ( Modal . prototype , 'renderIntoSubtree' ) . and . callThrough ( ) ;
149+ const wrapper = mount (
150+ < Modal isOpen = { isOpen } toggle = { toggle } >
151+ Yo!
152+ </ Modal >
153+ ) ;
154+
155+ jasmine . clock ( ) . tick ( 300 ) ;
156+ expect ( isOpen ) . toBe ( true ) ;
157+ expect ( Modal . prototype . togglePortal . calls . count ( ) ) . toEqual ( 0 ) ;
158+ expect ( Modal . prototype . renderIntoSubtree . calls . count ( ) ) . toEqual ( 1 ) ;
159+
160+ wrapper . setProps ( {
161+ isOpen : isOpen
162+ } ) ;
163+ jasmine . clock ( ) . tick ( 300 ) ;
164+
165+ expect ( isOpen ) . toBe ( true ) ;
166+ expect ( Modal . prototype . togglePortal . calls . count ( ) ) . toEqual ( 0 ) ;
167+ expect ( Modal . prototype . renderIntoSubtree . calls . count ( ) ) . toEqual ( 2 ) ;
168+
169+ wrapper . unmount ( ) ;
170+ } ) ;
171+
145172 it ( 'should close modal when escape key pressed' , ( ) => {
146173 isOpen = true ;
147174 const wrapper = mount (
0 commit comments