browser_1795260_searchbar_overflow_toolbar.js (834B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const WIDGET_ID = "search-container"; 7 8 registerCleanupFunction(() => { 9 CustomizableUI.reset(); 10 }); 11 12 add_task(async function test_syncPreferenceWithWidget() { 13 // Move the searchbar to the nav bar. 14 CustomizableUI.addWidgetToArea(WIDGET_ID, CustomizableUI.AREA_NAVBAR); 15 16 let container = document.getElementById(WIDGET_ID); 17 // Set a disproportionately large width, which could be from a saved bigger 18 // window, or what not. 19 let width = window.innerWidth * 2; 20 container.setAttribute("width", width); 21 container.style.width = `${width}px`; 22 23 // Stuff shouldn't overflow. 24 Assert.less( 25 container.getBoundingClientRect().width, 26 window.innerWidth, 27 "Searchbar shouldn't overflow" 28 ); 29 });