@@ -81,14 +81,16 @@ test('keep focus when click on menu', async () => {
8181test ( 'restore focus after calling blur on inner component' , async ( ) => {
8282 const page = await bootstrap ( )
8383 const renderFn = jest . fn ( )
84+ const onChangeFn = jest . fn ( )
8485 await page . exposeFunction ( 'renderFn' , renderFn )
86+ await page . exposeFunction ( 'onChangeFn' , onChangeFn )
8587
8688 await page . evaluate ( ( ) => {
8789 const React = window . React
8890 const FocusManager = window . ReactPowerPlug . FocusManager
8991
9092 const App = ( ) => (
91- < FocusManager >
93+ < FocusManager onChange = { window . onChangeFn } >
9294 { ( { isFocused, blur, bind } ) => {
9395 window . renderFn ( { isFocused } )
9496 const stopPropagation = e => e . stopPropagation ( )
@@ -115,8 +117,11 @@ test('restore focus after calling blur on inner component', async () => {
115117 expect ( renderFn ) . lastCalledWith ( { isFocused : false } )
116118 await page . click ( '#outer' )
117119 expect ( renderFn ) . lastCalledWith ( { isFocused : true } )
120+ expect ( onChangeFn ) . lastCalledWith ( { isFocused : true } )
118121 await page . click ( '#inner' )
119122 expect ( renderFn ) . lastCalledWith ( { isFocused : false } )
123+ expect ( onChangeFn ) . lastCalledWith ( { isFocused : false } )
120124 await page . click ( '#outer' )
121125 expect ( renderFn ) . lastCalledWith ( { isFocused : true } )
126+ expect ( onChangeFn ) . lastCalledWith ( { isFocused : true } )
122127} )
0 commit comments