browser_aboutdebugging_devtoolstoolbox_zoom.js (1990B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /* import-globals-from helper-collapsibilities.js */ 7 Services.scriptloader.loadSubScript( 8 CHROME_URL_ROOT + "helper-collapsibilities.js", 9 this 10 ); 11 12 const L10N = new LocalizationHelper( 13 "devtools/client/locales/toolbox.properties" 14 ); 15 16 // Check that the about:devtools-toolbox tab can be zoomed in and that the zoom 17 // persists after switching tabs. 18 add_task(async function () { 19 info("Force all debug target panes to be expanded"); 20 prepareCollapsibilitiesTest(); 21 22 const { document, tab, window } = await openAboutDebugging(); 23 await selectThisFirefoxPage(document, window.AboutDebugging.store); 24 const { devtoolsTab, devtoolsWindow } = await openAboutDevtoolsToolbox( 25 document, 26 tab, 27 window 28 ); 29 30 is(getZoom(devtoolsWindow), 1, "default zoom level correct"); 31 32 info("Increase the zoom level"); 33 34 // Note that we read the shortcut from the toolbox properties, but that should 35 // match the default browser shortcut `full-zoom-enlarge-shortcut`. 36 synthesizeKeyShortcut(L10N.getStr("toolbox.zoomIn.key")); 37 await waitFor(() => getZoom(devtoolsWindow) > 1); 38 is(getZoom(devtoolsWindow).toFixed(2), "1.10", "zoom level increased"); 39 40 info("Switch tabs between about:debugging and the toolbox tab"); 41 gBrowser.selectedTab = tab; 42 gBrowser.selectedTab = devtoolsTab; 43 44 info("Wait for the browser to reapply the zoom"); 45 await wait(500); 46 47 is( 48 getZoom(devtoolsWindow).toFixed(2), 49 "1.10", 50 "zoom level was restored after switching tabs" 51 ); 52 53 info("Restore the default zoom level"); 54 synthesizeKeyShortcut(L10N.getStr("toolbox.zoomReset.key")); 55 await waitFor(() => getZoom(devtoolsWindow) === 1); 56 is(getZoom(devtoolsWindow), 1, "default zoom level restored"); 57 58 await closeAboutDevtoolsToolbox(document, devtoolsTab, window); 59 await removeTab(tab); 60 }); 61 62 function getZoom(win) { 63 return win.browsingContext.fullZoom; 64 }