Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* vim: set ts=2 et sw=2 tw=80: */
2 /* Any copyright is dedicated to the Public Domain.
3 http://creativecommons.org/publicdomain/zero/1.0/ */
5 function test()
6 {
7 waitForExplicitFinish();
9 gBrowser.selectedTab = gBrowser.addTab();
10 gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
11 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
12 openScratchpad(runTests);
13 }, true);
15 content.location = "data:text/html;charset=utf8,<p>test inspect() in Scratchpad</p>";
16 }
18 function runTests()
19 {
20 let sp = gScratchpadWindow.Scratchpad;
22 sp.setText("({ a: 'foobarBug636725' })");
24 sp.inspect().then(function() {
25 let sidebar = sp.sidebar;
26 ok(sidebar.visible, "sidebar is open");
29 let found = false;
31 outer: for (let scope of sidebar.variablesView) {
32 for (let [, obj] of scope) {
33 for (let [, prop] of obj) {
34 if (prop.name == "a" && prop.value == "foobarBug636725") {
35 found = true;
36 break outer;
37 }
38 }
39 }
40 }
42 ok(found, "found the property");
44 let tabbox = sidebar._sidebar._tabbox;
45 is(tabbox.width, 300, "Scratchpad sidebar width is correct");
46 ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible");
47 sidebar.hide();
48 ok(tabbox.hasAttribute("hidden"), "Scratchpad sidebar hidden");
49 sp.inspect().then(function() {
50 is(tabbox.width, 300, "Scratchpad sidebar width is still correct");
51 ok(!tabbox.hasAttribute("hidden"), "Scratchpad sidebar visible again");
52 finish();
53 });
54 });
55 }