@@ -151,6 +151,26 @@ describe('<Tabs />', () => {
151151 assertTabSelected ( 1 ) ;
152152 } ) ;
153153
154+ test ( 'should not do anything when arrow right key pressed and no other tab available' , async ( ) => {
155+ render (
156+ < Tabs >
157+ < TabList >
158+ < Tab data-testid = "tab1" > Tab1</ Tab >
159+ < Tab data-testid = "tab2" disabled >
160+ Tab2
161+ </ Tab >
162+ </ TabList >
163+ < TabPanel data-testid = "panel1" > Hello Tab1</ TabPanel >
164+ < TabPanel data-testid = "panel2" > Hello Tab2</ TabPanel >
165+ </ Tabs > ,
166+ ) ;
167+ const element = screen . getByTestId ( 'tab1' ) ;
168+ await userEvent . click ( element ) ;
169+ await userEvent . keyboard ( '{ArrowRight}' ) ;
170+
171+ assertTabSelected ( 1 ) ;
172+ } ) ;
173+
154174 test ( 'should overflow when arrow left key pressed and no left tab available' , async ( ) => {
155175 render ( createTabs ( ) ) ;
156176 const element = screen . getByTestId ( 'tab1' ) ;
@@ -160,6 +180,26 @@ describe('<Tabs />', () => {
160180 assertTabSelected ( 3 ) ;
161181 } ) ;
162182
183+ test ( 'should not do anything when arrow left key pressed and no other tab available' , async ( ) => {
184+ render (
185+ < Tabs >
186+ < TabList >
187+ < Tab data-testid = "tab1" disabled >
188+ Tab1
189+ </ Tab >
190+ < Tab data-testid = "tab2" > Tab2</ Tab >
191+ </ TabList >
192+ < TabPanel data-testid = "panel1" > Hello Tab1</ TabPanel >
193+ < TabPanel data-testid = "panel2" > Hello Tab2</ TabPanel >
194+ </ Tabs > ,
195+ ) ;
196+ const element = screen . getByTestId ( 'tab2' ) ;
197+ await userEvent . click ( element ) ;
198+ await userEvent . keyboard ( '{ArrowLeft}' ) ;
199+
200+ assertTabSelected ( 2 ) ;
201+ } ) ;
202+
163203 test ( 'should move to first tab on home key' , async ( ) => {
164204 render ( createTabs ( ) ) ;
165205 const element = screen . getByTestId ( 'tab3' ) ;
0 commit comments