browser_storage_sidebar_toggle.js (1694B)
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 // Test to verify that the sidebar toggles when the toggle button is clicked. 6 7 "use strict"; 8 9 const testCases = [ 10 { 11 location: ["cookies", "https://sectest1.example.org"], 12 sidebarHidden: true, 13 toggleButtonVisible: false, 14 }, 15 { 16 location: getCookieId("cs2", ".example.org", "/"), 17 sidebarHidden: false, 18 toggleButtonVisible: true, 19 }, 20 { 21 clickToggle: true, 22 }, 23 { 24 location: getCookieId("cs2", ".example.org", "/"), 25 sidebarHidden: true, 26 }, 27 ]; 28 29 add_task(async function () { 30 // storage-listings.html explicitly mixes secure and insecure frames. 31 // We should not enforce https for tests using this page. 32 await pushPref("dom.security.https_first", false); 33 34 await openTabAndSetupStorage(MAIN_DOMAIN + "storage-listings.html"); 35 36 for (const test of testCases) { 37 const { location, sidebarHidden, clickToggle, toggleButtonVisible } = test; 38 39 info("running " + JSON.stringify(test)); 40 41 if (Array.isArray(location)) { 42 await selectTreeItem(location); 43 } else if (location) { 44 await selectTableItem(location); 45 } 46 47 if (clickToggle) { 48 toggleSidebar(); 49 } else if (typeof toggleButtonHidden !== "undefined") { 50 is( 51 sidebarToggleVisible(), 52 toggleButtonVisible, 53 "correct visibility state of toggle button" 54 ); 55 } else { 56 is( 57 gUI.sidebar.hidden, 58 sidebarHidden, 59 "correct visibility state of sidebar." 60 ); 61 } 62 63 info("-".repeat(80)); 64 } 65 });