@@ -136,9 +136,12 @@ describe("Tab", () => {
136136
137137 const tab = screen . getByRole ( "tab" , { name : "Test Tab" } ) ;
138138 expect ( tab ) . toBeInTheDocument ( ) ;
139- expect ( tab ) . toHaveAttribute ( "href" , "#test" ) ;
140- expect ( tab ) . toHaveAttribute ( "tabindex" , "0" ) ;
141- expect ( tab ) . toHaveAttribute ( "id" , "test-tab" ) ;
139+ expect ( tab ) . toHaveAttribute ( "aria-selected" , "true" ) ;
140+
141+ const link = tab . querySelector ( "a" ) ;
142+ expect ( link ) . toHaveAttribute ( "href" , "#test" ) ;
143+ expect ( link ) . toHaveAttribute ( "tabindex" , "0" ) ;
144+ expect ( link ) . toHaveAttribute ( "id" , "test-tab" ) ;
142145 } ) ;
143146
144147 it ( "should render with custom label" , ( ) => {
@@ -153,29 +156,34 @@ describe("Tab", () => {
153156 render ( Tab , { props : { href : "/custom" } } ) ;
154157
155158 const tab = screen . getByRole ( "tab" ) ;
156- expect ( tab ) . toHaveAttribute ( "href" , "/custom" ) ;
159+ const link = tab . querySelector ( "a" ) ;
160+ expect ( link ) . toHaveAttribute ( "href" , "/custom" ) ;
157161 } ) ;
158162
159163 it ( "should handle disabled state" , ( ) => {
160164 render ( Tab , { props : { disabled : true } } ) ;
161165
162166 const tab = screen . getByRole ( "tab" ) ;
163167 expect ( tab ) . toHaveAttribute ( "aria-disabled" , "true" ) ;
164- expect ( tab ) . toHaveAttribute ( "tabindex" , "-1" ) ;
168+
169+ const link = tab . querySelector ( "a" ) ;
170+ expect ( link ) . toHaveAttribute ( "tabindex" , "-1" ) ;
165171 } ) ;
166172
167173 it ( "should handle custom tabindex" , ( ) => {
168174 render ( Tab , { props : { tabindex : "1" } } ) ;
169175
170176 const tab = screen . getByRole ( "tab" ) ;
171- expect ( tab ) . toHaveAttribute ( "tabindex" , "1" ) ;
177+ const link = tab . querySelector ( "a" ) ;
178+ expect ( link ) . toHaveAttribute ( "tabindex" , "1" ) ;
172179 } ) ;
173180
174181 it ( "should handle custom id" , ( ) => {
175182 render ( Tab , { props : { id : "custom-id" } } ) ;
176183
177184 const tab = screen . getByRole ( "tab" ) ;
178- expect ( tab ) . toHaveAttribute ( "id" , "custom-id" ) ;
185+ const link = tab . querySelector ( "a" ) ;
186+ expect ( link ) . toHaveAttribute ( "id" , "custom-id" ) ;
179187 } ) ;
180188
181189 it ( "should be clickable when enabled" , async ( ) => {
0 commit comments