browser_947914_button_zoomIn.js (1887B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 add_task(async function () { 8 info("Check zoom in button existence and functionality"); 9 10 is(ZoomManager.zoom, 1, "Initial zoom factor should be 1"); 11 12 CustomizableUI.addWidgetToArea( 13 "zoom-controls", 14 CustomizableUI.AREA_FIXED_OVERFLOW_PANEL 15 ); 16 17 registerCleanupFunction(async () => { 18 CustomizableUI.reset(); 19 let gContentPrefs = Cc["@mozilla.org/content-pref/service;1"].getService( 20 Ci.nsIContentPrefService2 21 ); 22 let gLoadContext = Cu.createLoadContext(); 23 await new Promise(resolve => { 24 gContentPrefs.removeByName(window.FullZoom.name, gLoadContext, { 25 handleResult() {}, 26 handleCompletion() { 27 resolve(); 28 }, 29 }); 30 }); 31 }); 32 33 await waitForOverflowButtonShown(); 34 35 await document.getElementById("nav-bar").overflowable.show(); 36 info("Menu panel was opened"); 37 38 let zoomInButton = document.getElementById("zoom-in-button"); 39 ok(zoomInButton, "Zoom in button exists in Panel Menu"); 40 41 zoomInButton.click(); 42 let pageZoomLevel = parseInt(ZoomManager.zoom * 100); 43 info("Page zoom level is: " + pageZoomLevel); 44 45 let zoomResetButton = document.getElementById("zoom-reset-button"); 46 await TestUtils.waitForCondition(() => { 47 info( 48 "Current zoom is " + parseInt(zoomResetButton.getAttribute("label"), 10) 49 ); 50 return parseInt(zoomResetButton.getAttribute("label"), 10) == pageZoomLevel; 51 }); 52 53 Assert.greater(pageZoomLevel, 100, "Page zoomed in correctly"); 54 55 // close the Panel 56 let panelHiddenPromise = promiseOverflowHidden(window); 57 document.getElementById("widget-overflow").hidePopup(); 58 await panelHiddenPromise; 59 info("Menu panel was closed"); 60 });