browser_sidebar_persist.js (1185B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 add_task(async function persist_sidebar_width() { 7 { 8 // Make the main test window not count as a browser window any longer, 9 // which allows the persitence code to kick in. 10 const docEl = document.documentElement; 11 const oldWinType = docEl.getAttribute("windowtype"); 12 docEl.setAttribute("windowtype", "navigator:testrunner"); 13 registerCleanupFunction(() => { 14 docEl.setAttribute("windowtype", oldWinType); 15 }); 16 } 17 18 { 19 info("Showing new window and setting sidebar box"); 20 const win = await BrowserTestUtils.openNewBrowserWindow(); 21 await win.SidebarController.show("viewBookmarksSidebar"); 22 win.document.getElementById("sidebar-box").style.width = "100px"; 23 await BrowserTestUtils.closeWindow(win); 24 } 25 26 { 27 info("Showing new window and seeing persisted width"); 28 const win = await BrowserTestUtils.openNewBrowserWindow(); 29 is( 30 win.document.getElementById("sidebar-box").style.width, 31 "100px", 32 "Width style should be persisted" 33 ); 34 await BrowserTestUtils.closeWindow(win); 35 } 36 });