@@ -539,4 +539,67 @@ describe("Tabs", () => {
539539      expect ( newTabButtons [ 2 ] ) . toHaveAttribute ( "aria-selected" ,  "true" ) ; 
540540    } ) ; 
541541  } ) ; 
542+ 
543+   it ( "should set vertical aria-orientation" ,  ( )  =>  { 
544+     const  wrapper  =  render ( 
545+       < Tabs  isVertical  aria-label = "Tabs vertical test"  data-testid = "tabWrapper" > 
546+         < Tab  key = "item1"  title = "Item 1" > 
547+           < div > Content 1</ div > 
548+         </ Tab > 
549+         < Tab  key = "item2"  title = "Item 2" > 
550+           < div > Content 2</ div > 
551+         </ Tab > 
552+         < Tab  key = "item3"  title = "Item 3" > 
553+           < div > Content 3</ div > 
554+         </ Tab > 
555+       </ Tabs > , 
556+     ) ; 
557+ 
558+     const  tablist  =  wrapper . getByRole ( "tablist" ) ; 
559+ 
560+     expect ( tablist ) . toHaveAttribute ( "aria-orientation" ,  "vertical" ) ; 
561+   } ) ; 
562+ 
563+   it ( "should allow vertical tabs to navigate with up and down arrows" ,  async  ( )  =>  { 
564+     const  wrapper  =  render ( 
565+       < Tabs  isVertical  aria-label = "Tabs vertical test"  data-testid = "tabWrapper" > 
566+         < Tab  key = "item1"  title = "Item 1" > 
567+           < div > Content 1</ div > 
568+         </ Tab > 
569+         < Tab  key = "item2"  title = "Item 2" > 
570+           < div > Content 2</ div > 
571+         </ Tab > 
572+         < Tab  key = "item3"  title = "Item 3" > 
573+           < div > Content 3</ div > 
574+         </ Tab > 
575+       </ Tabs > , 
576+     ) ; 
577+ 
578+     const  tab1  =  wrapper . getByRole ( "tab" ,  { name : "Item 1" } ) ; 
579+     const  tab2  =  wrapper . getByRole ( "tab" ,  { name : "Item 2" } ) ; 
580+     const  tab3  =  wrapper . getByRole ( "tab" ,  { name : "Item 3" } ) ; 
581+ 
582+     expect ( tab1 ) . toHaveAttribute ( "aria-selected" ,  "true" ) ; 
583+     expect ( tab2 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
584+     expect ( tab3 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
585+ 
586+     act ( ( )  =>  { 
587+       focus ( tab1 ) ; 
588+     } ) ; 
589+ 
590+     await  user . keyboard ( "[ArrowDown]" ) ; 
591+     expect ( tab1 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
592+     expect ( tab2 ) . toHaveAttribute ( "aria-selected" ,  "true" ) ; 
593+     expect ( tab3 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
594+ 
595+     await  user . keyboard ( "[ArrowDown]" ) ; 
596+     expect ( tab1 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
597+     expect ( tab2 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
598+     expect ( tab3 ) . toHaveAttribute ( "aria-selected" ,  "true" ) ; 
599+ 
600+     await  user . keyboard ( "[ArrowUp]" ) ; 
601+     expect ( tab1 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
602+     expect ( tab2 ) . toHaveAttribute ( "aria-selected" ,  "true" ) ; 
603+     expect ( tab3 ) . toHaveAttribute ( "aria-selected" ,  "false" ) ; 
604+   } ) ; 
542605} ) ; 
0 commit comments