1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-06.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,77 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Tests opening the variable inspection popup on a variable which has a 1.9 + * complext object as the value. 1.10 + */ 1.11 + 1.12 +const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; 1.13 + 1.14 +function test() { 1.15 + requestLongerTimeout(2); 1.16 + Task.spawn(function() { 1.17 + let [tab, debuggee, panel] = yield initDebugger(TAB_URL); 1.18 + let win = panel.panelWin; 1.19 + let bubble = win.DebuggerView.VariableBubble; 1.20 + let tooltip = bubble._tooltip.panel; 1.21 + 1.22 + function verifyContents() { 1.23 + is(tooltip.querySelectorAll(".variables-view-container").length, 1, 1.24 + "There should be one variables view container added to the tooltip."); 1.25 + 1.26 + is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1, 1.27 + "There should be one scope with no header displayed."); 1.28 + is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1, 1.29 + "There should be one variable with no header displayed."); 1.30 + 1.31 + is(tooltip.querySelectorAll(".variables-view-property").length, 7, 1.32 + "There should be 7 properties displayed."); 1.33 + 1.34 + is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a", 1.35 + "The first property's name is correct."); 1.36 + is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1", 1.37 + "The first property's value is correct."); 1.38 + 1.39 + is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "b", 1.40 + "The second property's name is correct."); 1.41 + is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "\"beta\"", 1.42 + "The second property's value is correct."); 1.43 + 1.44 + is(tooltip.querySelectorAll(".variables-view-property .name")[2].getAttribute("value"), "c", 1.45 + "The third property's name is correct."); 1.46 + is(tooltip.querySelectorAll(".variables-view-property .value")[2].getAttribute("value"), "3", 1.47 + "The third property's value is correct."); 1.48 + 1.49 + is(tooltip.querySelectorAll(".variables-view-property .name")[3].getAttribute("value"), "d", 1.50 + "The fourth property's name is correct."); 1.51 + is(tooltip.querySelectorAll(".variables-view-property .value")[3].getAttribute("value"), "false", 1.52 + "The fourth property's value is correct."); 1.53 + 1.54 + is(tooltip.querySelectorAll(".variables-view-property .name")[4].getAttribute("value"), "e", 1.55 + "The fifth property's name is correct."); 1.56 + is(tooltip.querySelectorAll(".variables-view-property .value")[4].getAttribute("value"), "null", 1.57 + "The fifth property's value is correct."); 1.58 + 1.59 + is(tooltip.querySelectorAll(".variables-view-property .name")[5].getAttribute("value"), "f", 1.60 + "The sixth property's name is correct."); 1.61 + is(tooltip.querySelectorAll(".variables-view-property .value")[5].getAttribute("value"), "undefined", 1.62 + "The sixth property's value is correct."); 1.63 + 1.64 + is(tooltip.querySelectorAll(".variables-view-property .name")[6].getAttribute("value"), "__proto__", 1.65 + "The seventh property's name is correct."); 1.66 + is(tooltip.querySelectorAll(".variables-view-property .value")[6].getAttribute("value"), "Object", 1.67 + "The seventh property's value is correct."); 1.68 + } 1.69 + 1.70 + // Allow this generator function to yield first. 1.71 + executeSoon(() => debuggee.start()); 1.72 + yield waitForSourceAndCaretAndScopes(panel, ".html", 24); 1.73 + 1.74 + // Inspect variable. 1.75 + yield openVarPopup(panel, { line: 17, ch: 12 }, true); 1.76 + verifyContents(); 1.77 + 1.78 + yield resumeDebuggerThenCloseAndFinish(panel); 1.79 + }); 1.80 +}