From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- .../test/browser/browser_downloads_panel_height.js | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 browser/components/downloads/test/browser/browser_downloads_panel_height.js (limited to 'browser/components/downloads/test/browser/browser_downloads_panel_height.js') diff --git a/browser/components/downloads/test/browser/browser_downloads_panel_height.js b/browser/components/downloads/test/browser/browser_downloads_panel_height.js new file mode 100644 index 0000000000..b154d20f84 --- /dev/null +++ b/browser/components/downloads/test/browser/browser_downloads_panel_height.js @@ -0,0 +1,35 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * This test exists because we use a element and it handles + * some of the height changes for us. We need to verify that the height is + * updated correctly if downloads are removed while the panel is hidden. + */ +add_task(async function test_height_reduced_after_removal() { + await SpecialPowers.pushPrefEnv({ + set: [["browser.download.autohideButton", false]], + }); + await promiseButtonShown("downloads-button"); + // downloading two items since the download panel only shows up when at least one item is in it + await task_addDownloads([{ state: DownloadsCommon.DOWNLOAD_FINISHED }]); + await task_addDownloads([{ state: DownloadsCommon.DOWNLOAD_FINISHED }]); + + await task_openPanel(); + let panel = document.getElementById("downloadsPanel"); + let heightBeforeRemoval = panel.getBoundingClientRect().height; + + // We want to close the panel before we remove the download from the list. + DownloadsPanel.hidePanel(); + await task_resetState(); + // keep at least one item in the download list since the panel disabled when it is empty + await task_addDownloads([{ state: DownloadsCommon.DOWNLOAD_FINISHED }]); + + await task_openPanel(); + let heightAfterRemoval = panel.getBoundingClientRect().height; + Assert.greater(heightBeforeRemoval, heightAfterRemoval); + + await task_resetState(); +}); -- cgit v1.2.3