File tree 1 file changed +15
-0
lines changed
packages/react/src/tabs/root
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -184,6 +184,21 @@ describe('<Tabs.Root />', () => {
184
184
expect ( handleChange . firstCall . args [ 0 ] ) . to . equal ( 1 ) ;
185
185
} ) ;
186
186
187
+ it ( 'should not call onValueChange on non-primary button clicks' , async ( ) => {
188
+ const handleChange = spy ( ) ;
189
+ const { getAllByRole } = await render (
190
+ < Tabs . Root value = { 0 } onValueChange = { handleChange } >
191
+ < Tabs . List >
192
+ < Tabs . Tab value = { 0 } />
193
+ < Tabs . Tab value = { 1 } />
194
+ </ Tabs . List >
195
+ </ Tabs . Root > ,
196
+ ) ;
197
+
198
+ fireEvent . click ( getAllByRole ( 'tab' ) [ 1 ] , { button : 2 } ) ;
199
+ expect ( handleChange . callCount ) . to . equal ( 0 ) ;
200
+ } ) ;
201
+
187
202
it ( 'should not call onValueChange when already selected' , async ( ) => {
188
203
const handleChange = spy ( ) ;
189
204
const { getAllByRole } = await render (
You can’t perform that action at this time.
0 commit comments