@@ -154,11 +154,11 @@ describe('Tab', () => {
154154 } )
155155
156156 describe ( 'onTabChange' , ( ) => {
157- it ( 'is called with (e, { ...props, activeIndex }) a menu item is clicked' , ( ) => {
157+ it ( 'is called when a menu item is clicked' , ( ) => {
158158 const activeIndex = 1
159- const spy = sandbox . spy ( )
159+ const onTabChange = sandbox . spy ( )
160160 const event = { fake : 'event' }
161- const props = { onTabChange : spy , panes }
161+ const props = { onTabChange, panes }
162162
163163 mount ( < Tab { ...props } /> )
164164 . find ( 'MenuItem' )
@@ -167,30 +167,29 @@ describe('Tab', () => {
167167
168168 // Since React will have generated a key the returned tab won't match
169169 // exactly so match on the props instead.
170- spy . should . have . been . calledOnce ( )
171- spy . firstCall . args [ 0 ] . should . have . property ( 'fake' , 'event' )
172- spy . firstCall . args [ 1 ] . should . have . property ( 'activeIndex' , 1 )
173- spy . firstCall . args [ 1 ] . should . have . property ( 'onTabChange' , spy )
174- spy . firstCall . args [ 1 ] . should . have . property ( 'panes' , panes )
170+ onTabChange . should . have . been . calledOnce ( )
171+ onTabChange . should . have . been . calledWithMatch ( event , props , 1 )
175172 } )
176173 it ( 'is called with the new proposed activeIndex, not the current' , ( ) => {
177- const spy = sandbox . spy ( )
174+ const onTabChange = sandbox . spy ( )
178175
179- const items = mount ( < Tab activeIndex = { - 1 } onTabChange = { spy } panes = { panes } /> ) . find ( 'MenuItem' )
176+ const items = mount ( < Tab activeIndex = { - 1 } onTabChange = { onTabChange } panes = { panes } /> ) . find (
177+ 'MenuItem' ,
178+ )
180179
181- spy . should . have . callCount ( 0 )
180+ onTabChange . should . have . callCount ( 0 )
182181
183182 items . at ( 0 ) . simulate ( 'click' )
184- spy . should . have . callCount ( 1 )
185- spy . lastCall . args [ 1 ] . should . have . property ( 'activeIndex' , 0 )
183+ onTabChange . should . have . callCount ( 1 )
184+ onTabChange . lastCall . args [ 2 ] . should . equal ( 0 )
186185
187186 items . at ( 1 ) . simulate ( 'click' )
188- spy . should . have . callCount ( 2 )
189- spy . lastCall . args [ 1 ] . should . have . property ( 'activeIndex' , 1 )
187+ onTabChange . should . have . callCount ( 2 )
188+ onTabChange . lastCall . args [ 2 ] . should . equal ( 1 )
190189
191190 items . at ( 2 ) . simulate ( 'click' )
192- spy . should . have . callCount ( 3 )
193- spy . lastCall . args [ 1 ] . should . have . property ( 'activeIndex' , 2 )
191+ onTabChange . should . have . callCount ( 3 )
192+ onTabChange . lastCall . args [ 2 ] . should . equal ( 2 )
194193 } )
195194 } )
196195
0 commit comments