Skip to content

Commit 47363a3

Browse files
devvaannshabose
authored andcommitted
fix: context menu opening on tab right click test failing
1 parent 8a86a7f commit 47363a3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/spec/Extn-Tabbar-integ-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)