Skip to content

Commit 1a1ca73

Browse files
committed
fix: custom function tests for tab bar failing
1 parent af72d2a commit 1a1ca73

File tree

1 file changed

+57
-21
lines changed

1 file changed

+57
-21
lines changed

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

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,7 +1907,7 @@ define(function (require, exports, module) {
19071907
const $closeTabOption = getContextMenu()
19081908
.find(".menu-name")
19091909
.filter(function () {
1910-
return $(this).text().trim() === "Close";
1910+
return $(this).text().trim() === Strings.CMD_FILE_CLOSE;
19111911
})
19121912
.closest("li");
19131913
expect($closeTabOption.length).toBe(1);
@@ -1957,25 +1957,34 @@ define(function (require, exports, module) {
19571957
const $tab = getTab(testFilePath);
19581958

19591959
// Right-click on the first tab to open context menu
1960-
$tab.trigger("contextmenu", {
1960+
const mousedownEvent = $.Event("mousedown", {
1961+
button: 2,
1962+
pageX: 100,
1963+
pageY: 100
1964+
});
1965+
$tab.trigger(mousedownEvent);
1966+
1967+
const contextmenuEvent = $.Event("contextmenu", {
19611968
pageX: 100,
19621969
pageY: 100
19631970
});
1971+
$tab.trigger(contextmenuEvent);
19641972

19651973
// Wait for context menu to appear
19661974
await awaitsFor(
19671975
function () {
1968-
return getContextMenu().length > 0;
1976+
return getContextMenu().hasClass("open");
19691977
},
19701978
"Context menu to appear"
19711979
);
19721980

1973-
// Find and click the "Close tabs to the right" option
1981+
// Find and click the "Close Tabs to the Right" option
19741982
const $closeTabsToRightOption = getContextMenu()
1975-
.find("a.stylesheet-link")
1983+
.find(".menu-name")
19761984
.filter(function () {
19771985
return $(this).text().trim() === Strings.CLOSE_TABS_TO_THE_RIGHT;
1978-
});
1986+
})
1987+
.closest("li");
19791988
expect($closeTabsToRightOption.length).toBe(1);
19801989
$closeTabsToRightOption.click();
19811990

@@ -2029,25 +2038,34 @@ define(function (require, exports, module) {
20292038
const $tab = getTab(testFilePath3);
20302039

20312040
// Right-click on the third tab to open context menu
2032-
$tab.trigger("contextmenu", {
2041+
const mousedownEvent = $.Event("mousedown", {
2042+
button: 2,
2043+
pageX: 100,
2044+
pageY: 100
2045+
});
2046+
$tab.trigger(mousedownEvent);
2047+
2048+
const contextmenuEvent = $.Event("contextmenu", {
20332049
pageX: 100,
20342050
pageY: 100
20352051
});
2052+
$tab.trigger(contextmenuEvent);
20362053

20372054
// Wait for context menu to appear
20382055
await awaitsFor(
20392056
function () {
2040-
return getContextMenu().length > 0;
2057+
return getContextMenu().hasClass("open");
20412058
},
20422059
"Context menu to appear"
20432060
);
20442061

2045-
// Find and click the "Close tabs to the left" option
2062+
// Find and click the "Close Tabs to the Left" option
20462063
const $closeTabsToLeftOption = getContextMenu()
2047-
.find("a.stylesheet-link")
2064+
.find(".menu-name")
20482065
.filter(function () {
20492066
return $(this).text().trim() === Strings.CLOSE_TABS_TO_THE_LEFT;
2050-
});
2067+
})
2068+
.closest("li");
20512069
expect($closeTabsToLeftOption.length).toBe(1);
20522070
$closeTabsToLeftOption.click();
20532071

@@ -2116,25 +2134,34 @@ define(function (require, exports, module) {
21162134
const $tab = getTab(testFilePath);
21172135

21182136
// Right-click on the tab to open context menu
2119-
$tab.trigger("contextmenu", {
2137+
const mousedownEvent = $.Event("mousedown", {
2138+
button: 2,
2139+
pageX: 100,
2140+
pageY: 100
2141+
});
2142+
$tab.trigger(mousedownEvent);
2143+
2144+
const contextmenuEvent = $.Event("contextmenu", {
21202145
pageX: 100,
21212146
pageY: 100
21222147
});
2148+
$tab.trigger(contextmenuEvent);
21232149

21242150
// Wait for context menu to appear
21252151
await awaitsFor(
21262152
function () {
2127-
return getContextMenu().length > 0;
2153+
return getContextMenu().hasClass("open");
21282154
},
21292155
"Context menu to appear"
21302156
);
21312157

2132-
// Find and click the "Close saved tabs" option
2158+
// Find and click the "Close Saved Tabs" option
21332159
const $closeSavedTabsOption = getContextMenu()
2134-
.find("a.stylesheet-link")
2160+
.find(".menu-name")
21352161
.filter(function () {
21362162
return $(this).text().trim() === Strings.CLOSE_SAVED_TABS;
2137-
});
2163+
})
2164+
.closest("li");
21382165
expect($closeSavedTabsOption.length).toBe(1);
21392166
$closeSavedTabsOption.click();
21402167

@@ -2195,25 +2222,34 @@ define(function (require, exports, module) {
21952222
const $tab = getTab(testFilePath);
21962223

21972224
// Right-click on the tab to open context menu
2198-
$tab.trigger("contextmenu", {
2225+
const mousedownEvent = $.Event("mousedown", {
2226+
button: 2,
2227+
pageX: 100,
2228+
pageY: 100
2229+
});
2230+
$tab.trigger(mousedownEvent);
2231+
2232+
const contextmenuEvent = $.Event("contextmenu", {
21992233
pageX: 100,
22002234
pageY: 100
22012235
});
2236+
$tab.trigger(contextmenuEvent);
22022237

22032238
// Wait for context menu to appear
22042239
await awaitsFor(
22052240
function () {
2206-
return getContextMenu().length > 0;
2241+
return getContextMenu().hasClass("open");
22072242
},
22082243
"Context menu to appear"
22092244
);
22102245

2211-
// Find and click the "Close all tabs" option
2246+
// Find and click the "Close All Tabs" option
22122247
const $closeAllTabsOption = getContextMenu()
2213-
.find("a.stylesheet-link")
2248+
.find(".menu-name")
22142249
.filter(function () {
22152250
return $(this).text().trim() === Strings.CLOSE_ALL_TABS;
2216-
});
2251+
})
2252+
.closest("li");
22172253
expect($closeAllTabsOption.length).toBe(1);
22182254
$closeAllTabsOption.click();
22192255

0 commit comments

Comments
 (0)