Skip to content

Commit 57ac3b4

Browse files
devvaannshabose
authored andcommitted
fix: close tab context menu test failing
1 parent 47363a3 commit 57ac3b4

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

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

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,30 +1875,41 @@ define(function (require, exports, module) {
18751875
);
18761876
});
18771877

1878-
it("should close the tab when selecting 'Close Tab' from context menu", async function () {
1878+
it("should close the tab when selecting 'Close' from context menu", async function () {
18791879
// Get the tab element
18801880
const $tab = getTab(testFilePath);
18811881

18821882
// Right-click on the tab to open context menu
1883-
$tab.trigger("contextmenu", {
1883+
// First trigger mousedown to make the tab active
1884+
const mousedownEvent = $.Event("mousedown", {
1885+
button: 2,
1886+
pageX: 100,
1887+
pageY: 100
1888+
});
1889+
$tab.trigger(mousedownEvent);
1890+
1891+
// Then trigger contextmenu to open the menu
1892+
const contextmenuEvent = $.Event("contextmenu", {
18841893
pageX: 100,
18851894
pageY: 100
18861895
});
1896+
$tab.trigger(contextmenuEvent);
18871897

18881898
// Wait for context menu to appear
18891899
await awaitsFor(
18901900
function () {
1891-
return getContextMenu().length > 0;
1901+
return getContextMenu().hasClass("open");
18921902
},
18931903
"Context menu to appear"
18941904
);
18951905

1896-
// Find and click the "Close Tab" option
1906+
// Find and click the "Close" option
18971907
const $closeTabOption = getContextMenu()
1898-
.find("a.stylesheet-link")
1908+
.find(".menu-name")
18991909
.filter(function () {
1900-
return $(this).text().trim() === Strings.CLOSE_TAB;
1901-
});
1910+
return $(this).text().trim() === "Close";
1911+
})
1912+
.closest("li");
19021913
expect($closeTabOption.length).toBe(1);
19031914
$closeTabOption.click();
19041915

0 commit comments

Comments
 (0)