File tree 1 file changed +38
-0
lines changed
1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,44 @@ describe('React', () => {
201
201
expect ( stub . props . pass ) . toEqual ( 'through' )
202
202
} )
203
203
204
+ it ( 'should handle unexpected prop changes with forceUpdate()' , ( ) => {
205
+ const store = createStore ( ( ) => ( { } ) )
206
+
207
+ @connect ( state => state )
208
+ class ConnectContainer extends Component {
209
+ render ( ) {
210
+ return (
211
+ < Passthrough { ...this . props } pass = { this . props . bar } />
212
+ )
213
+ }
214
+ }
215
+
216
+ class Container extends Component {
217
+ constructor ( ) {
218
+ super ( )
219
+ this . bar = 'baz'
220
+ }
221
+
222
+ componentDidMount ( ) {
223
+ this . bar = 'foo'
224
+ this . forceUpdate ( )
225
+ this . c . forceUpdate ( )
226
+ }
227
+
228
+ render ( ) {
229
+ return (
230
+ < ProviderMock store = { store } >
231
+ < ConnectContainer bar = { this . bar } ref = { c => this . c = c } />
232
+ </ ProviderMock >
233
+ )
234
+ }
235
+ }
236
+
237
+ const container = TestUtils . renderIntoDocument ( < Container /> )
238
+ const stub = TestUtils . findRenderedComponentWithType ( container , Passthrough )
239
+ expect ( stub . props . bar ) . toEqual ( 'foo' )
240
+ } )
241
+
204
242
it ( 'should remove undefined props' , ( ) => {
205
243
const store = createStore ( ( ) => ( { } ) )
206
244
let props = { x : true }
You can’t perform that action at this time.
0 commit comments