michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Tests opening the variable inspection popup on a variable which has a michael@0: * simple object as the value. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_frame-parameters.html"; michael@0: michael@0: function test() { michael@0: Task.spawn(function() { michael@0: let [tab, debuggee, panel] = yield initDebugger(TAB_URL); michael@0: let win = panel.panelWin; michael@0: let bubble = win.DebuggerView.VariableBubble; michael@0: let tooltip = bubble._tooltip.panel; michael@0: michael@0: function verifyContents() { michael@0: is(tooltip.querySelectorAll(".variables-view-container").length, 1, michael@0: "There should be one variables view container added to the tooltip."); michael@0: michael@0: is(tooltip.querySelectorAll(".variables-view-scope[untitled]").length, 1, michael@0: "There should be one scope with no header displayed."); michael@0: is(tooltip.querySelectorAll(".variables-view-variable[untitled]").length, 1, michael@0: "There should be one variable with no header displayed."); michael@0: michael@0: is(tooltip.querySelectorAll(".variables-view-property").length, 2, michael@0: "There should be 2 properties displayed."); michael@0: michael@0: is(tooltip.querySelectorAll(".variables-view-property .name")[0].getAttribute("value"), "a", michael@0: "The first property's name is correct."); michael@0: is(tooltip.querySelectorAll(".variables-view-property .value")[0].getAttribute("value"), "1", michael@0: "The first property's value is correct."); michael@0: michael@0: is(tooltip.querySelectorAll(".variables-view-property .name")[1].getAttribute("value"), "__proto__", michael@0: "The second property's name is correct."); michael@0: is(tooltip.querySelectorAll(".variables-view-property .value")[1].getAttribute("value"), "Object", michael@0: "The second property's value is correct."); michael@0: } michael@0: michael@0: // Allow this generator function to yield first. michael@0: executeSoon(() => debuggee.start()); michael@0: yield waitForSourceAndCaretAndScopes(panel, ".html", 24); michael@0: michael@0: // Inspect variable. michael@0: yield openVarPopup(panel, { line: 16, ch: 12 }, true); michael@0: verifyContents(); michael@0: michael@0: yield resumeDebuggerThenCloseAndFinish(panel); michael@0: }); michael@0: }