Bug 992679 - Context item to open split console and log element. r=harth

This commit is contained in:
Willian Gustavo Veiga 2014-09-05 15:50:00 +02:00
Родитель e310a71f9c
Коммит 6a251f1848
4 изменённых файлов: 41 добавлений и 1 удалений

Просмотреть файл

@ -736,6 +736,19 @@ InspectorPanel.prototype = {
}
},
/**
* Show DOM properties
*/
showDOMProperties: function InspectorPanel_showDOMProperties() {
this._toolbox.openSplitConsole().then(() => {
let panel = this._toolbox.getPanel("webconsole");
let jsterm = panel.hud.jsterm;
jsterm.execute("inspect($0)");
jsterm.focusInput();
});
},
/**
* Clear any pseudo-class locks applied to the current hierarchy.
*/

Просмотреть файл

@ -55,6 +55,9 @@
<menuitem id="node-menu-copyimagedatauri"
label="&inspectorCopyImageDataUri.label;"
oncommand="inspector.copyImageDataUri()"/>
<menuitem id="node-menu-showdomproperties"
label="&inspectorShowDOMProperties.label;"
oncommand="inspector.showDOMProperties()"/>
<menuseparator/>
<menuitem id="node-menu-pasteouterhtml"
label="&inspectorHTMLPasteOuter.label;"

Просмотреть файл

@ -80,11 +80,12 @@ registerCleanupFunction(() => {
});
let test = asyncTest(function* () {
let { inspector } = yield openInspectorForURL(TEST_URL);
let { inspector, toolbox } = yield openInspectorForURL(TEST_URL);
yield testMenuItemSensitivity();
yield testPasteOuterHTMLMenuItemSensitivity();
yield testCopyMenuItems();
yield testShowDOMProperties();
yield testPasteOuterHTMLMenu();
yield testDeleteNode();
yield testDeleteRootNode();
@ -154,6 +155,27 @@ let test = asyncTest(function* () {
}
}
function* testShowDOMProperties() {
info("Testing 'Show DOM Properties' menu item.");
let showDOMPropertiesNode = inspector.panelDoc.getElementById("node-menu-showdomproperties");
ok(showDOMPropertiesNode, "the popup menu has a show dom properties item");
let consoleOpened = toolbox.once("webconsole-ready");
info("Triggering 'Show DOM Properties' and waiting for inspector open");
dispatchCommandEvent(showDOMPropertiesNode);
yield consoleOpened;
let webconsoleUI = toolbox.getPanel("webconsole").hud.ui;
let messagesAdded = webconsoleUI.once("messages-added");
yield messagesAdded;
info("Checking if 'inspect($0)' was evaluated");
ok(webconsoleUI.jsterm.history[0] === 'inspect($0)');
yield toolbox.toggleSplitConsole();
}
function* testPasteOuterHTMLMenu() {
info("Testing that 'Paste Outer HTML' menu item works.");
clipboard.set("this was pasted");

Просмотреть файл

@ -22,3 +22,5 @@
<!ENTITY inspectorSearchHTML.key "F">
<!ENTITY inspectorCopyImageDataUri.label "Copy Image Data-URL">
<!ENTITY inspectorShowDOMProperties.label "Show DOM Properties">