File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -3567,4 +3567,33 @@ describeWithDOM('mount', () => {
35673567 } ) ;
35683568 } ) ;
35693569 } ) ;
3570+
3571+ describe ( 'out-of-band state updates' , ( ) => {
3572+ class Child extends React . Component {
3573+ render ( ) {
3574+ return < span /> ;
3575+ }
3576+ }
3577+
3578+ class Test extends React . Component {
3579+ callbackSetState ( ) {
3580+ this . setState ( { showSpan : true } ) ;
3581+ }
3582+
3583+ render ( ) {
3584+ return (
3585+ < div >
3586+ { this . state && this . state . showSpan && < span className = "show-me" /> }
3587+ < Child callback = { ( ) => this . callbackSetState ( ) } />
3588+ </ div >
3589+ ) ;
3590+ }
3591+ }
3592+
3593+ it ( 'should have updated output after child prop callback invokes setState' , ( ) => {
3594+ const wrapper = mount ( < Test /> ) ;
3595+ wrapper . find ( Child ) . props ( ) . callback ( ) ;
3596+ expect ( wrapper . find ( '.show-me' ) . length ) . to . equal ( 1 ) ;
3597+ } ) ;
3598+ } ) ;
35703599} ) ;
You can’t perform that action at this time.
0 commit comments