michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests if the network monitor panes collapse properly. michael@0: */ michael@0: michael@0: function test() { michael@0: initNetMonitor(SIMPLE_URL).then(([aTab, aDebuggee, aMonitor]) => { michael@0: info("Starting test... "); michael@0: michael@0: let { document, Prefs, NetMonitorView } = aMonitor.panelWin; michael@0: let detailsPane = document.getElementById("details-pane"); michael@0: let detailsPaneToggleButton = document.getElementById("details-pane-toggle"); michael@0: michael@0: ok(detailsPane.hasAttribute("pane-collapsed") && michael@0: detailsPaneToggleButton.hasAttribute("pane-collapsed"), michael@0: "The details pane should initially be hidden."); michael@0: michael@0: NetMonitorView.toggleDetailsPane({ visible: true, animated: false }); michael@0: michael@0: let width = ~~(detailsPane.getAttribute("width")); michael@0: is(width, Prefs.networkDetailsWidth, michael@0: "The details pane has an incorrect width."); michael@0: is(detailsPane.style.marginLeft, "0px", michael@0: "The details pane has an incorrect left margin."); michael@0: is(detailsPane.style.marginRight, "0px", michael@0: "The details pane has an incorrect right margin."); michael@0: ok(!detailsPane.hasAttribute("animated"), michael@0: "The details pane has an incorrect animated attribute."); michael@0: ok(!detailsPane.hasAttribute("pane-collapsed") && michael@0: !detailsPaneToggleButton.hasAttribute("pane-collapsed"), michael@0: "The details pane should at this point be visible."); michael@0: michael@0: NetMonitorView.toggleDetailsPane({ visible: false, animated: true }); michael@0: michael@0: let margin = -(width + 1) + "px"; michael@0: is(width, Prefs.networkDetailsWidth, michael@0: "The details pane has an incorrect width after collapsing."); michael@0: is(detailsPane.style.marginLeft, margin, michael@0: "The details pane has an incorrect left margin after collapsing."); michael@0: is(detailsPane.style.marginRight, margin, michael@0: "The details pane has an incorrect right margin after collapsing."); michael@0: ok(detailsPane.hasAttribute("animated"), michael@0: "The details pane has an incorrect attribute after an animated collapsing."); michael@0: ok(detailsPane.hasAttribute("pane-collapsed") && michael@0: detailsPaneToggleButton.hasAttribute("pane-collapsed"), michael@0: "The details pane should not be visible after collapsing."); michael@0: michael@0: NetMonitorView.toggleDetailsPane({ visible: true, animated: false }); michael@0: michael@0: is(width, Prefs.networkDetailsWidth, michael@0: "The details pane has an incorrect width after uncollapsing."); michael@0: is(detailsPane.style.marginLeft, "0px", michael@0: "The details pane has an incorrect left margin after uncollapsing."); michael@0: is(detailsPane.style.marginRight, "0px", michael@0: "The details pane has an incorrect right margin after uncollapsing."); michael@0: ok(!detailsPane.hasAttribute("animated"), michael@0: "The details pane has an incorrect attribute after an unanimated uncollapsing."); michael@0: ok(!detailsPane.hasAttribute("pane-collapsed") && michael@0: !detailsPaneToggleButton.hasAttribute("pane-collapsed"), michael@0: "The details pane should be visible again after uncollapsing."); michael@0: michael@0: teardown(aMonitor).then(finish); michael@0: }); michael@0: }