browser_net_pane-collapse.js (1921B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 /** 7 * Tests if the network monitor panes collapse properly. 8 */ 9 10 add_task(async function () { 11 const { monitor } = await initNetMonitor(SIMPLE_URL, { 12 requestCount: 1, 13 }); 14 info("Starting test... "); 15 16 const { document, store, windowRequire } = monitor.panelWin; 17 const Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); 18 const { Prefs } = windowRequire("devtools/client/netmonitor/src/utils/prefs"); 19 20 const wait = waitForNetworkEvents(monitor, 1); 21 await reloadBrowser(); 22 await wait; 23 24 ok( 25 !document.querySelector(".network-details-bar") && 26 !document.querySelector(".sidebar-toggle"), 27 "The details panel should initially be hidden." 28 ); 29 30 store.dispatch(Actions.toggleNetworkDetails()); 31 32 is( 33 ~~document.querySelector(".network-details-bar").clientWidth, 34 Prefs.networkDetailsWidth, 35 "The details panel has an incorrect width." 36 ); 37 ok( 38 document.querySelector(".network-details-bar") && 39 document.querySelector(".sidebar-toggle"), 40 "The details panel should at this point be visible." 41 ); 42 43 EventUtils.sendMouseEvent( 44 { type: "click" }, 45 document.querySelector(".sidebar-toggle") 46 ); 47 48 ok( 49 !document.querySelector(".network-details-bar") && 50 !document.querySelector(".sidebar-toggle"), 51 "The details panel should not be visible after collapsing." 52 ); 53 54 store.dispatch(Actions.toggleNetworkDetails()); 55 56 is( 57 ~~document.querySelector(".network-details-bar").clientWidth, 58 Prefs.networkDetailsWidth, 59 "The details panel has an incorrect width after uncollapsing." 60 ); 61 ok( 62 document.querySelector(".network-details-bar") && 63 document.querySelector(".sidebar-toggle"), 64 "The details panel should be visible again after uncollapsing." 65 ); 66 67 await teardown(monitor); 68 });