test: Added tests for closing glance, b=(no-bug), c=glance, tests

This commit is contained in:
Mr. M
2025-05-13 12:00:39 +02:00
parent 337b1aec53
commit 6552ec5f02
3 changed files with 33 additions and 2 deletions

View File

@@ -127,7 +127,7 @@
if (gZenVerticalTabsManager._prefsRightSide) {
this.sidebarButtons.setAttribute('right', true);
} else {
this.sidebarButtons.removeAttribute('right');
this.sidebarButtons.setAttribute('right', false);
}
for (const button of this.sidebarButtons.querySelectorAll('toolbarbutton')) {
button.style.opacity = 0;
@@ -256,7 +256,12 @@
hasFocused = false,
skipPermitUnload = false,
} = {}) {
if (this._animating || !this.#currentBrowser || this.animatingOpen || this._duringOpening) {
if (
(this._animating && !onTabClose) ||
!this.#currentBrowser ||
(this.animatingOpen && !onTabClose) ||
this._duringOpening
) {
return;
}

View File

@@ -5,3 +5,4 @@ support-files = [
["browser_glance_basic.js"]
["browser_glance_expand.js"]
["browser_glance_close.js"]

View File

@@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
https://creativecommons.org/publicdomain/zero/1.0/ */
'use strict';
add_task(async function test_Glance_Basic_Close() {
const currentTab = gBrowser.selectedTab;
await openGlanceOnTab(async (glanceTab) => {
ok(
currentTab.hasAttribute('glance-id'),
'The glance tab should have the zen-glance-tab attribute'
);
await BrowserTestUtils.removeTab(glanceTab);
await new Promise((resolve) => {
setTimeout(() => {
resolve();
}, 500);
});
ok(
!currentTab.hasAttribute('glance-id'),
'The glance tab should not have the zen-glance-tab attribute'
);
await BrowserTestUtils.removeTab(glanceTab);
}, false);
});