@@ -10,6 +10,7 @@ import '@umbraco-ui/uui-loader-bar/lib';
1010import { UUIMenuItemElement } from './uui-menu-item.element' ;
1111import { UUIMenuItemEvent } from './UUIMenuItemEvent' ;
1212import { UUISelectableEvent } from '@umbraco-ui/uui-base/lib/events' ;
13+ import { sendMouse } from '@web/test-runner-commands' ;
1314
1415describe ( 'UUIMenuItemElement' , ( ) => {
1516 let element : UUIMenuItemElement ;
@@ -287,21 +288,33 @@ describe('UUIMenuItemElement', () => {
287288
288289 it ( 'can be selected when selectable' , async ( ) => {
289290 await elementUpdated ( element ) ;
290- labelElement ?. click ( ) ;
291+ await sendMouse ( {
292+ type : 'click' ,
293+ position : [ 75 , 30 ] ,
294+ button : 'left' ,
295+ } ) ;
291296 expect ( element . selected ) . to . be . true ;
292297 } ) ;
293298
294299 it ( 'can not be selected when not selectable' , async ( ) => {
295300 element . selectable = false ;
296301 await elementUpdated ( element ) ;
297- labelElement ?. click ( ) ;
302+ await sendMouse ( {
303+ type : 'click' ,
304+ position : [ 75 , 30 ] ,
305+ button : 'left' ,
306+ } ) ;
298307 expect ( element . selected ) . to . be . false ;
299308 } ) ;
300309
301310 it ( 'can be selected when selectable' , async ( ) => {
302311 element . disabled = true ;
303312 await elementUpdated ( element ) ;
304- labelElement ?. click ( ) ;
313+ await sendMouse ( {
314+ type : 'click' ,
315+ position : [ 75 , 30 ] ,
316+ button : 'left' ,
317+ } ) ;
305318 expect ( element . selected ) . to . be . false ;
306319 } ) ;
307320
@@ -339,21 +352,33 @@ describe('UUIMenuItemElement', () => {
339352
340353 it ( 'can be selected when selectable' , async ( ) => {
341354 await elementUpdated ( element ) ;
342- labelElement ?. click ( ) ;
355+ await sendMouse ( {
356+ type : 'click' ,
357+ position : [ 75 , 30 ] ,
358+ button : 'left' ,
359+ } ) ;
343360 expect ( element . selected ) . to . be . true ;
344361 } ) ;
345362
346363 it ( 'can not be selected when not selectable' , async ( ) => {
347364 element . selectable = false ;
348365 await elementUpdated ( element ) ;
349- labelElement ?. click ( ) ;
366+ await sendMouse ( {
367+ type : 'click' ,
368+ position : [ 75 , 30 ] ,
369+ button : 'left' ,
370+ } ) ;
350371 expect ( element . selected ) . to . be . false ;
351372 } ) ;
352373
353- it ( 'can be selected when selectable ' , async ( ) => {
374+ it ( 'can not be selected when disabled ' , async ( ) => {
354375 element . disabled = true ;
355376 await elementUpdated ( element ) ;
356- labelElement ?. click ( ) ;
377+ await sendMouse ( {
378+ type : 'click' ,
379+ position : [ 75 , 30 ] ,
380+ button : 'left' ,
381+ } ) ;
357382 expect ( element . selected ) . to . be . false ;
358383 } ) ;
359384
0 commit comments