mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-04 14:18:31 +00:00
Merge branch 'dev' of https://github.com/zen-browser/desktop into dev
This commit is contained in:
@@ -8,6 +8,7 @@ support-files = [
|
||||
]
|
||||
|
||||
["browser_tabs_empty_checks.js"]
|
||||
["browser_tabs_close_recently.js"]
|
||||
["browser_tabs_fetch_checks.js"]
|
||||
["browser_tabs_cycle_by_attribute.js"]
|
||||
["browser_drag_drop_vertical.js"]
|
||||
|
||||
@@ -52,7 +52,7 @@ async function dropAfter(itemToDrag, itemToDropAfter, win) {
|
||||
const midline = rect.left + 0.5 * rect.width;
|
||||
// Point where bottom edge of `itemToDrag` overlaps `itemToDropAfter` enough
|
||||
// for `itemToDrag` to come after.
|
||||
const afterPoint = Math.ceil(rect.top + threshold * rect.height);
|
||||
const afterPoint = Math.ceil(rect.top + (threshold + 0.5) * rect.height);
|
||||
const dragTo = afterPoint - sourceRect.height / 2;
|
||||
await drop(itemToDrag, itemToDropAfter, midline, dragTo, win);
|
||||
}
|
||||
@@ -71,7 +71,7 @@ async function dropBefore(itemToDrag, itemToDropBefore, win) {
|
||||
const midline = rect.left + 0.5 * rect.width;
|
||||
// Point where top edge of `itemToDrag` overlaps `itemToDropBefore` enough
|
||||
// for `itemToDrag` to come before.
|
||||
const beforePoint = Math.floor(rect.top + (1 - threshold) * rect.height);
|
||||
const beforePoint = Math.floor(rect.top + (1 - threshold - 0.5) * rect.height);
|
||||
const dragTo = beforePoint + sourceRect.height / 2;
|
||||
await drop(itemToDrag, itemToDropBefore, midline, dragTo, win);
|
||||
}
|
||||
|
||||
80
src/zen/tests/tabs/browser_tabs_close_recently.js
Normal file
80
src/zen/tests/tabs/browser_tabs_close_recently.js
Normal file
@@ -0,0 +1,80 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
https://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const URL1 = "data:text/plain,tab1";
|
||||
const URL2 = "data:text/plain,tab2";
|
||||
const URL3 = "data:text/plain,tab3";
|
||||
|
||||
add_task(async function test_blurToRecentlyClosedTab() {
|
||||
const [tab1, tab2, tab3] = [
|
||||
BrowserTestUtils.addTab(gBrowser, URL1),
|
||||
BrowserTestUtils.addTab(gBrowser, URL2),
|
||||
BrowserTestUtils.addTab(gBrowser, URL3),
|
||||
];
|
||||
|
||||
gBrowser.selectedTab = tab2;
|
||||
gBrowser.selectedTab = tab3;
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
||||
gBrowser.selectedTab = tab2;
|
||||
gBrowser.removeTab(tab2);
|
||||
|
||||
Assert.equal(
|
||||
gBrowser.selectedTab,
|
||||
tab1,
|
||||
"After closing the most recently used tab, the selection moves to the last used tab"
|
||||
);
|
||||
|
||||
gBrowser.selectedTab = tab3;
|
||||
gBrowser.removeTab(tab3);
|
||||
|
||||
Assert.equal(
|
||||
gBrowser.selectedTab,
|
||||
tab1,
|
||||
"After closing the most recently used tab, the selection moves to the last used tab"
|
||||
);
|
||||
|
||||
gBrowser.removeTab(tab1);
|
||||
});
|
||||
|
||||
add_task(async function test_closeToLastTab() {
|
||||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["zen.tabs.select-recently-used-on-close", false],
|
||||
["zen.view.show-newtab-button-top", false],
|
||||
],
|
||||
});
|
||||
|
||||
const [tab1, tab2, tab3] = [
|
||||
BrowserTestUtils.addTab(gBrowser, URL1),
|
||||
BrowserTestUtils.addTab(gBrowser, URL2),
|
||||
BrowserTestUtils.addTab(gBrowser, URL3),
|
||||
];
|
||||
|
||||
gBrowser.selectedTab = tab2;
|
||||
gBrowser.selectedTab = tab3;
|
||||
gBrowser.selectedTab = tab1;
|
||||
|
||||
gBrowser.selectedTab = tab2;
|
||||
gBrowser.removeTab(tab2);
|
||||
|
||||
Assert.equal(
|
||||
gBrowser.selectedTab,
|
||||
tab3,
|
||||
"After closing the current tab, the selection moves to the next tab in order"
|
||||
);
|
||||
|
||||
gBrowser.selectedTab = tab1;
|
||||
gBrowser.removeTab(tab1);
|
||||
|
||||
Assert.equal(
|
||||
gBrowser.selectedTab,
|
||||
tab3,
|
||||
"After closing the current tab, the selection moves to the next tab in order"
|
||||
);
|
||||
|
||||
gBrowser.removeTab(tab3);
|
||||
await SpecialPowers.popPrefEnv();
|
||||
});
|
||||
Reference in New Issue
Block a user