|
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/ */ |
|
4 |
|
5 function test() |
|
6 { |
|
7 waitForExplicitFinish(); |
|
8 |
|
9 gBrowser.selectedTab = gBrowser.addTab(); |
|
10 gBrowser.selectedBrowser.addEventListener("load", function onLoad() { |
|
11 gBrowser.selectedBrowser.removeEventListener("load", onLoad, true); |
|
12 openScratchpad(runTests); |
|
13 }, true); |
|
14 |
|
15 content.location = "data:text/html;charset=utf8,<p>test inspect() in Scratchpad</p>"; |
|
16 } |
|
17 |
|
18 function runTests() |
|
19 { |
|
20 let sp = gScratchpadWindow.Scratchpad; |
|
21 |
|
22 sp.setText("({ a: 'foobarBug636725' })"); |
|
23 |
|
24 sp.inspect().then(function() { |
|
25 let sidebar = sp.sidebar; |
|
26 ok(sidebar.visible, "sidebar is open"); |
|
27 |
|
28 |
|
29 let found = false; |
|
30 |
|
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 } |
|
41 |
|
42 ok(found, "found the property"); |
|
43 |
|
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 } |