@@ -137,7 +137,7 @@ describe("ContextualMenu ", () => {
137137
138138 it ( "can display links" , ( ) => {
139139 render ( < ContextualMenu links = { [ { children : "Link1" } ] } visible /> ) ;
140- expect ( screen . getByRole ( "button " , { name : "Link1" } ) ) . toBeInTheDocument ( ) ;
140+ expect ( screen . getByRole ( "menuitem " , { name : "Link1" } ) ) . toBeInTheDocument ( ) ;
141141 } ) ;
142142
143143 it ( "can display links in groups" , ( ) => {
@@ -147,7 +147,7 @@ describe("ContextualMenu ", () => {
147147 ) as HTMLElement ;
148148 expect ( group ) . toBeInTheDocument ( ) ;
149149 expect (
150- within ( group ) . getByRole ( "button " , { name : "Link1" } ) ,
150+ within ( group ) . getByRole ( "menuitem " , { name : "Link1" } ) ,
151151 ) . toBeInTheDocument ( ) ;
152152 } ) ;
153153
@@ -163,12 +163,12 @@ describe("ContextualMenu ", () => {
163163 ) as HTMLElement ;
164164 expect ( group ) . toBeInTheDocument ( ) ;
165165 expect (
166- within ( group ) . getByRole ( "button " , { name : "Link1" } ) ,
166+ within ( group ) . getByRole ( "menuitem " , { name : "Link1" } ) ,
167167 ) . toBeInTheDocument ( ) ;
168168 expect (
169- within ( group ) . queryByRole ( "button " , { name : "Link2" } ) ,
169+ within ( group ) . queryByRole ( "menuitem " , { name : "Link2" } ) ,
170170 ) . not . toBeInTheDocument ( ) ;
171- expect ( screen . getByRole ( "button " , { name : "Link2" } ) ) . toBeInTheDocument ( ) ;
171+ expect ( screen . getByRole ( "menuitem " , { name : "Link2" } ) ) . toBeInTheDocument ( ) ;
172172 } ) ;
173173
174174 it ( "can supply content instead of links" , ( ) => {
@@ -194,7 +194,7 @@ describe("ContextualMenu ", () => {
194194 await userEvent . click ( screen . getByRole ( "button" , { name : "Toggle" } ) ) ;
195195 expect ( screen . getByLabelText ( DropdownLabel . Dropdown ) ) . toBeInTheDocument ( ) ;
196196 // Click on an item:
197- await userEvent . click ( screen . getByRole ( "button " , { name : "Link1" } ) ) ;
197+ await userEvent . click ( screen . getByRole ( "menuitem " , { name : "Link1" } ) ) ;
198198 expect (
199199 screen . queryByLabelText ( DropdownLabel . Dropdown ) ,
200200 ) . not . toBeInTheDocument ( ) ;
0 commit comments