@@ -4,13 +4,15 @@ import React from 'react';
44import  {  assert  }  from  'chai' ; 
55import  {  spy ,  stub ,  useFakeTimers  }  from  'sinon' ; 
66import  scroll  from  'scroll' ; 
7- import  {  createShallow ,  createMount ,  getClasses  }  from  '../test-utils' ; 
7+ import  {  createShallow ,  createMount ,  getClasses ,   unwrap  }  from  '../test-utils' ; 
88import  consoleErrorMock  from  '../../test/utils/consoleErrorMock' ; 
99import  Tabs  from  './Tabs' ; 
1010import  TabScrollButton  from  './TabScrollButton' ; 
1111import  TabIndicator  from  './TabIndicator' ; 
1212import  Tab  from  './Tab' ; 
1313
14+ const  TabsNaked  =  unwrap ( Tabs ) ; 
15+ 
1416const  noop  =  ( )  =>  { } ; 
1517const  fakeTabs  =  { 
1618  getBoundingClientRect : ( )  =>  ( { } ) , 
@@ -207,6 +209,33 @@ describe('<Tabs />', () => {
207209        ) ; 
208210        assert . strictEqual ( wrapper2 . find ( TabIndicator ) . length ,  1 ) ; 
209211      } ) ; 
212+ 
213+       it ( 'should update the indicator state no matter what' ,  ( )  =>  { 
214+         const  wrapper2  =  mount ( 
215+           < TabsNaked  width = "md"  onChange = { noop }  value = { 1 }  classes = { { } }  theme = { { } } > 
216+             < Tab  /> 
217+             < Tab  /> 
218+           </ TabsNaked > , 
219+         ) ; 
220+         const  instance  =  wrapper2 . instance ( ) ; 
221+         stub ( instance ,  'scrollSelectedIntoView' ) ; 
222+ 
223+         wrapper2 . setState ( { 
224+           indicatorStyle : { 
225+             left : 10 , 
226+             width : 40 , 
227+           } , 
228+         } ) ; 
229+         wrapper2 . setProps ( { 
230+           value : 0 , 
231+         } ) ; 
232+ 
233+         assert . strictEqual ( 
234+           instance . scrollSelectedIntoView . callCount  >=  2 , 
235+           true , 
236+           'should have called scrollSelectedIntoView' , 
237+         ) ; 
238+       } ) ; 
210239    } ) ; 
211240
212241    it ( 'should warn when the value is invalid' ,  ( )  =>  { 
0 commit comments