@@ -1837,7 +1837,7 @@ define(function (require, exports, module) {
18371837 * @returns {jQuery } - The context menu element
18381838 */
18391839 function getContextMenu ( ) {
1840- return $ ( ". tabbar-context-menu" ) ;
1840+ return $ ( "# tabbar-context-menu" ) ;
18411841 }
18421842
18431843 it ( "should open context menu when right-clicking on a tab" , async function ( ) {
@@ -1846,30 +1846,30 @@ define(function (require, exports, module) {
18461846 expect ( $tab . length ) . toBe ( 1 ) ;
18471847
18481848 // Simulate a right-click (contextmenu) event on the tab
1849- $tab . trigger ( "contextmenu" , {
1849+ const event = $ . Event ( "contextmenu" , {
18501850 pageX : 100 ,
18511851 pageY : 100
18521852 } ) ;
1853+ $tab . trigger ( event ) ;
18531854
18541855 // Wait for the context menu to appear
18551856 await awaitsFor (
18561857 function ( ) {
1857- return getContextMenu ( ) . length > 0 ;
1858+ return getContextMenu ( ) . hasClass ( "open" ) ;
18581859 } ,
18591860 "Context menu to appear"
18601861 ) ;
18611862
1862- // Verify the context menu is visible
1863- expect ( getContextMenu ( ) . length ) . toBe ( 1 ) ;
1864- expect ( getContextMenu ( ) . is ( ":visible" ) ) . toBe ( true ) ;
1863+ // Verify the context menu is open
1864+ expect ( getContextMenu ( ) . hasClass ( "open" ) ) . toBe ( true ) ;
18651865
18661866 // Clean up - close the context menu by clicking elsewhere
18671867 $ ( "body" ) . click ( ) ;
18681868
18691869 // Wait for the context menu to disappear
18701870 await awaitsFor (
18711871 function ( ) {
1872- return getContextMenu ( ) . length === 0 ;
1872+ return ! getContextMenu ( ) . hasClass ( "open" ) ;
18731873 } ,
18741874 "Context menu to disappear"
18751875 ) ;
0 commit comments