|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Tests opening the variable inspection popup on a variable which has a |
|
6 * complext object as the value. |
|
7 */ |
|
8 |
|
9 const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; |
|
10 |
|
11 function test() { |
|
12 requestLongerTimeout(2); |
|
13 Task.spawn(function() { |
|
14 let [tab, debuggee, panel] = yield initDebugger(TAB_URL); |
|
15 let win = panel.panelWin; |
|
16 let bubble = win.DebuggerView.VariableBubble; |
|
17 let tooltip = bubble._tooltip.panel; |
|
18 |
|
19 function verifyContents() { |
|
20 is(tooltip.querySelectorAll(".variables-view-container").length, 1, |
|
21 "There should be one variables view container added to the tooltip."); |
|
22 |
|
23 is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1, |
|
24 "There should be one scope with no header displayed."); |
|
25 is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1, |
|
26 "There should be one variable with no header displayed."); |
|
27 |
|
28 is(tooltip.querySelectorAll(".variables-view-property").length, 7, |
|
29 "There should be 7 properties displayed."); |
|
30 |
|
31 is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a", |
|
32 "The first property's name is correct."); |
|
33 is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1", |
|
34 "The first property's value is correct."); |
|
35 |
|
36 is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "b", |
|
37 "The second property's name is correct."); |
|
38 is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "\"beta\"", |
|
39 "The second property's value is correct."); |
|
40 |
|
41 is(tooltip.querySelectorAll(".variables-view-property .name")[2].getAttribute("value"), "c", |
|
42 "The third property's name is correct."); |
|
43 is(tooltip.querySelectorAll(".variables-view-property .value")[2].getAttribute("value"), "3", |
|
44 "The third property's value is correct."); |
|
45 |
|
46 is(tooltip.querySelectorAll(".variables-view-property .name")[3].getAttribute("value"), "d", |
|
47 "The fourth property's name is correct."); |
|
48 is(tooltip.querySelectorAll(".variables-view-property .value")[3].getAttribute("value"), "false", |
|
49 "The fourth property's value is correct."); |
|
50 |
|
51 is(tooltip.querySelectorAll(".variables-view-property .name")[4].getAttribute("value"), "e", |
|
52 "The fifth property's name is correct."); |
|
53 is(tooltip.querySelectorAll(".variables-view-property .value")[4].getAttribute("value"), "null", |
|
54 "The fifth property's value is correct."); |
|
55 |
|
56 is(tooltip.querySelectorAll(".variables-view-property .name")[5].getAttribute("value"), "f", |
|
57 "The sixth property's name is correct."); |
|
58 is(tooltip.querySelectorAll(".variables-view-property .value")[5].getAttribute("value"), "undefined", |
|
59 "The sixth property's value is correct."); |
|
60 |
|
61 is(tooltip.querySelectorAll(".variables-view-property .name")[6].getAttribute("value"), "__proto__", |
|
62 "The seventh property's name is correct."); |
|
63 is(tooltip.querySelectorAll(".variables-view-property .value")[6].getAttribute("value"), "Object", |
|
64 "The seventh property's value is correct."); |
|
65 } |
|
66 |
|
67 // Allow this generator function to yield first. |
|
68 executeSoon(() => debuggee.start()); |
|
69 yield waitForSourceAndCaretAndScopes(panel, ".html", 24); |
|
70 |
|
71 // Inspect variable. |
|
72 yield openVarPopup(panel, { line: 17, ch: 12 }, true); |
|
73 verifyContents(); |
|
74 |
|
75 yield resumeDebuggerThenCloseAndFinish(panel); |
|
76 }); |
|
77 } |