michael@0: /* vim: set ts=2 et sw=2 tw=80: */ michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() michael@0: { michael@0: waitForExplicitFinish(); michael@0: michael@0: gBrowser.selectedTab = gBrowser.addTab(); michael@0: gBrowser.selectedBrowser.addEventListener("load", function onLoad() { michael@0: gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); michael@0: openScratchpad(runTests); michael@0: }, true); michael@0: michael@0: content.location = "data:text/html;charset=utf8,

test inspect() in Scratchpad

"; michael@0: } michael@0: michael@0: function runTests() michael@0: { michael@0: let sp = gScratchpadWindow.Scratchpad; michael@0: michael@0: sp.setText("({ a: 'foobarBug636725' })"); michael@0: michael@0: sp.inspect().then(function() { michael@0: let sidebar = sp.sidebar; michael@0: ok(sidebar.visible, "sidebar is open"); michael@0: michael@0: michael@0: let found = false; michael@0: michael@0: outer: for (let scope of sidebar.variablesView) { michael@0: for (let [, obj] of scope) { michael@0: for (let [, prop] of obj) { michael@0: if (prop.name == "a" && prop.value == "foobarBug636725") { michael@0: found = true; michael@0: break outer; michael@0: } michael@0: } michael@0: } michael@0: } michael@0: michael@0: ok(found, "found the property"); michael@0: michael@0: let tabbox = sidebar._sidebar._tabbox; michael@0: is(tabbox.width, 300, "Scratchpad sidebar width is correct"); michael@0: ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible"); michael@0: sidebar.hide(); michael@0: ok(tabbox.hasAttribute("hidden"), "Scratchpad sidebar hidden"); michael@0: sp.inspect().then(function() { michael@0: is(tabbox.width, 300, "Scratchpad sidebar width is still correct"); michael@0: ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible again"); michael@0: finish(); michael@0: }); michael@0: }); michael@0: }