# HG changeset patch # Parent 0e98873849991e15508077f92bcf0d417464e73b # User Patrick Brosset Bug 952277 - DOMNodes can be highlighted and selected from the debugger - Debugger test; r=vporof diff --git a/browser/devtools/debugger/test/browser.ini b/browser/devtools/debugger/test/browser.ini --- a/browser/devtools/debugger/test/browser.ini +++ b/browser/devtools/debugger/test/browser.ini @@ -60,16 +60,17 @@ support-files = doc_scope-variable-2.html doc_scope-variable-3.html doc_script-switching-01.html doc_script-switching-02.html doc_step-out.html doc_tracing-01.html doc_watch-expressions.html doc_with-frame.html + doc_domnode-variables.html head.js sjs_random-javascript.sjs testactors.js [browser_dbg_aaa_run_first_leaktest.js] [browser_dbg_auto-pretty-print-01.js] [browser_dbg_auto-pretty-print-02.js] [browser_dbg_bfcache.js] @@ -237,16 +238,17 @@ support-files = [browser_dbg_variables-view-popup-02.js] [browser_dbg_variables-view-popup-03.js] [browser_dbg_variables-view-popup-04.js] [browser_dbg_variables-view-popup-05.js] [browser_dbg_variables-view-popup-06.js] [browser_dbg_variables-view-popup-07.js] [browser_dbg_variables-view-popup-08.js] [browser_dbg_variables-view-popup-09.js] +[browser_dbg_variables-view-popup-10.js] [browser_dbg_variables-view-reexpand-01.js] [browser_dbg_variables-view-reexpand-02.js] [browser_dbg_variables-view-webidl.js] [browser_dbg_watch-expressions-01.js] [browser_dbg_watch-expressions-02.js] [browser_dbg_search-function.js] [browser_dbg_chrome-create.js] skip-if = os == "linux" # Bug 847558 diff --git a/browser/devtools/debugger/test/browser_dbg_variables-view-popup-10.js b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-10.js new file mode 100644 --- /dev/null +++ b/browser/devtools/debugger/test/browser_dbg_variables-view-popup-10.js @@ -0,0 +1,63 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * Tests that the variable inspection popup has inspector links for DOMNode + * properties and that the popup closes when the link is clicked + */ + +const TAB_URL = EXAMPLE_URL + "doc_domnode-variables.html"; + +function test() { + Task.spawn(function() { + let [tab, debuggee, panel] = yield initDebugger(TAB_URL); + let win = panel.panelWin; + let bubble = win.DebuggerView.VariableBubble; + let tooltip = bubble._tooltip.panel; + let toolbox = gDevTools.getToolbox(panel.target); + + function getDomNodeInTooltip(propertyName) { + let domNodeProperties = tooltip.querySelectorAll(".token-domnode"); + for (let prop of domNodeProperties) { + let propName = prop.parentNode.querySelector(".name"); + if (propName.getAttribute("value") === propertyName) { + ok(true, "DOMNode " + propertyName + " was found in the tooltip"); + return prop; + } + } + ok(false, "DOMNode " + propertyName + " wasn't found in the tooltip"); + } + + function verifyContents(textContent, className) { + is(tooltip.querySelector(".devtools-tooltip-simple-text").textContent, textContent, + "The inspected property's value is correct."); + ok(tooltip.querySelector(".devtools-tooltip-simple-text").className.contains(className), + "The inspected property's value is colorized correctly."); + } + + // Allow this generator function to yield first. + executeSoon(() => debuggee.start()); + yield waitForSourceAndCaretAndScopes(panel, ".html", 19); + + // Inspect the div DOM variable. + yield openVarPopup(panel, { line: 17, ch: 38 }, true); + let property = getDomNodeInTooltip("firstElementChild"); + + // Simulate mouseover on the property value + EventUtils.sendMouseEvent({ type: "mouseover" }, property, + property.ownerDocument.defaultView); + yield once(toolbox, "node-highlight"); + ok(true, "The node-highlight event was fired on hover of the DOMNode"); + + // Simulate a click on the "select in inspector" button + let button = property.parentNode.querySelector(".variables-view-open-inspector"); + ok(button, "The select-in-inspector button is present"); + EventUtils.sendMouseEvent({ type: "mousedown" }, button, + button.ownerDocument.defaultView); + yield once(toolbox, "inspector-selected"); + ok(true, "The inspector got selected when clicked on the select-in-inspector"); + + yield once(toolbox.getPanel("inspector"), "inspector-updated"); + yield resumeDebuggerThenCloseAndFinish(panel); + }); +} diff --git a/browser/devtools/debugger/test/doc_domnode-variables.html b/browser/devtools/debugger/test/doc_domnode-variables.html new file mode 100644 --- /dev/null +++ b/browser/devtools/debugger/test/doc_domnode-variables.html @@ -0,0 +1,24 @@ + + + + + + + Debugger test page + + + +
Look at this DIV! Just look at it!
+ + + + +