browser_toolbox_toolbar_overflow.js (2750B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test that a button to access tools hidden by toolbar overflow is displayed when the 7 // toolbar starts to present an overflow. 8 const { Toolbox } = require("resource://devtools/client/framework/toolbox.js"); 9 10 add_task(async function () { 11 const tab = await addTab("about:blank"); 12 13 info("Open devtools on the Inspector in a bottom dock"); 14 const toolbox = await openToolboxForTab( 15 tab, 16 "inspector", 17 Toolbox.HostType.BOTTOM 18 ); 19 20 const hostWindow = toolbox.topWindow; 21 const originalWidth = hostWindow.outerWidth; 22 const originalHeight = hostWindow.outerHeight; 23 24 info( 25 "Resize devtools window to a width that should not trigger any overflow" 26 ); 27 let onResize = once(hostWindow, "resize"); 28 hostWindow.resizeTo(1350, 300); 29 await onResize; 30 31 info("Wait for all buttons to be displayed"); 32 await waitUntil(() => { 33 return ( 34 toolbox.panelDefinitions.length === 35 toolbox.doc.querySelectorAll(".devtools-tab").length 36 ); 37 }); 38 39 let chevronMenuButton = toolbox.doc.querySelector(".tools-chevron-menu"); 40 ok(!chevronMenuButton, "The chevron menu button is not displayed"); 41 42 info("Resize devtools window to a width that should trigger an overflow"); 43 onResize = once(hostWindow, "resize"); 44 hostWindow.resizeTo(800, 300); 45 await onResize; 46 await waitUntil(() => !toolbox.doc.querySelector(".tools-chevron-menu")); 47 48 info("Wait until the chevron menu button is available"); 49 await waitUntil(() => toolbox.doc.querySelector(".tools-chevron-menu")); 50 51 chevronMenuButton = toolbox.doc.querySelector(".tools-chevron-menu"); 52 ok(chevronMenuButton, "The chevron menu button is displayed"); 53 54 info( 55 "Open the tools-chevron-menupopup and verify that the inspector button is checked" 56 ); 57 await openChevronMenu(toolbox); 58 59 const inspectorButton = toolbox.doc.querySelector( 60 "#tools-chevron-menupopup-inspector" 61 ); 62 ok(!inspectorButton, "The chevron menu doesn't have the inspector button."); 63 64 const consoleButton = toolbox.doc.querySelector( 65 "#tools-chevron-menupopup-webconsole" 66 ); 67 ok(!consoleButton, "The chevron menu doesn't have the console button."); 68 69 const storageButton = toolbox.doc.querySelector( 70 "#tools-chevron-menupopup-storage" 71 ); 72 ok(storageButton, "The chevron menu has the storage button."); 73 74 info("Switch to the performance using the tools-chevron-menupopup popup"); 75 const onSelected = toolbox.once("storage-selected"); 76 storageButton.click(); 77 await onSelected; 78 79 info("Restore the original window size"); 80 onResize = once(hostWindow, "resize"); 81 hostWindow.resizeTo(originalWidth, originalHeight); 82 await onResize; 83 });