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_searchbar_widths.js | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 browser/components/search/test/browser/browser_searchbar_widths.js (limited to 'browser/components/search/test/browser/browser_searchbar_widths.js') diff --git a/browser/components/search/test/browser/browser_searchbar_widths.js b/browser/components/search/test/browser/browser_searchbar_widths.js new file mode 100644 index 0000000000..3e17ebf833 --- /dev/null +++ b/browser/components/search/test/browser/browser_searchbar_widths.js @@ -0,0 +1,33 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Check that when the searchbar has a specific width, opening a new window +// honours that specific width. +add_task(async function test_searchbar_width_persistence() { + await gCUITestUtils.addSearchBar(); + registerCleanupFunction(async function () { + gCUITestUtils.removeSearchBar(); + }); + + // Really, we should use the splitter, but drag/drop is hard and fragile in + // tests, so let's just fake it real quick: + let container = BrowserSearch.searchBar.parentNode; + // There's no width attribute set initially, just grab the info from layout: + let oldWidth = container.getBoundingClientRect().width; + let newWidth = "" + Math.round(oldWidth * 2); + container.setAttribute("width", newWidth); + + let win = await BrowserTestUtils.openNewBrowserWindow(); + let otherBar = win.BrowserSearch.searchBar; + ok(otherBar, "Should have a search bar in the other window"); + if (otherBar) { + is( + otherBar.parentNode.getAttribute("width"), + newWidth, + "Should have matching width" + ); + } + await BrowserTestUtils.closeWindow(win); +}); -- cgit v1.2.3