зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1274303 - fix gcli "inspect" command; r=jwalker
MozReview-Commit-ID: GeTUvJqvrKx --HG-- extra : rebase_source : 59048383ea0f63c9ea1fcb4e986446d6db954096
This commit is contained in:
Родитель
bcd208c716
Коммит
0625980878
|
@ -13,24 +13,26 @@ const Telemetry = require("devtools/client/shared/telemetry");
|
|||
|
||||
exports.items = [{
|
||||
item: "command",
|
||||
runAt: "server",
|
||||
runAt: "client",
|
||||
name: "inspect",
|
||||
description: l10n.lookup("inspectDesc"),
|
||||
manual: l10n.lookup("inspectManual"),
|
||||
params: [
|
||||
{
|
||||
name: "selector",
|
||||
type: "node",
|
||||
type: "string",
|
||||
description: l10n.lookup("inspectNodeDesc"),
|
||||
manual: l10n.lookup("inspectNodeManual")
|
||||
}
|
||||
],
|
||||
exec: function (args, context) {
|
||||
exec: function* (args, context) {
|
||||
let target = context.environment.target;
|
||||
return gDevTools.showToolbox(target, "inspector").then(toolbox => {
|
||||
toolbox.getCurrentPanel().selection.setNode(args.selector, "gcli");
|
||||
});
|
||||
}
|
||||
let toolbox = yield gDevTools.showToolbox(target, "inspector");
|
||||
let walker = toolbox.getCurrentPanel().walker;
|
||||
let rootNode = yield walker.getRootNode();
|
||||
let nodeFront = yield walker.querySelector(rootNode, args.selector);
|
||||
toolbox.getCurrentPanel().selection.setNodeFront(nodeFront, "gcli");
|
||||
},
|
||||
}, {
|
||||
item: "command",
|
||||
runAt: "client",
|
||||
|
|
|
@ -9,8 +9,15 @@
|
|||
const TEST_URI = URL_ROOT + "doc_inspector_gcli-inspect-command.html";
|
||||
|
||||
add_task(function* () {
|
||||
return helpers.addTabWithToolbar(TEST_URI, function (options) {
|
||||
return helpers.audit(options, [
|
||||
return helpers.addTabWithToolbar(TEST_URI, Task.async(function* (options) {
|
||||
let {inspector} = yield openInspector();
|
||||
|
||||
let checkSelection = Task.async(function* (selector) {
|
||||
let node = yield getNodeFront(selector, inspector);
|
||||
is(inspector.selection.nodeFront, node, "the current selection is correct");
|
||||
});
|
||||
|
||||
yield helpers.audit(options, [
|
||||
{
|
||||
setup: "inspect",
|
||||
check: {
|
||||
|
@ -25,30 +32,6 @@ add_task(function* () {
|
|||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
setup: "inspect h1",
|
||||
check: {
|
||||
input: "inspect h1",
|
||||
hints: "",
|
||||
markup: "VVVVVVVVII",
|
||||
status: "ERROR",
|
||||
args: {
|
||||
selector: { message: "No matches" },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
setup: "inspect span",
|
||||
check: {
|
||||
input: "inspect span",
|
||||
hints: "",
|
||||
markup: "VVVVVVVVEEEE",
|
||||
status: "ERROR",
|
||||
args: {
|
||||
selector: { message: "Too many matches (2)" },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
setup: "inspect div",
|
||||
check: {
|
||||
|
@ -60,18 +43,8 @@ add_task(function* () {
|
|||
selector: { message: "" },
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
setup: "inspect .someclas",
|
||||
check: {
|
||||
input: "inspect .someclas",
|
||||
hints: "",
|
||||
markup: "VVVVVVVVIIIIIIIII",
|
||||
status: "ERROR",
|
||||
args: {
|
||||
selector: { message: "No matches" },
|
||||
}
|
||||
},
|
||||
exec: {},
|
||||
post: () => checkSelection("div"),
|
||||
},
|
||||
{
|
||||
setup: "inspect .someclass",
|
||||
|
@ -84,6 +57,8 @@ add_task(function* () {
|
|||
selector: { message: "" },
|
||||
}
|
||||
},
|
||||
exec: {},
|
||||
post: () => checkSelection(".someclass"),
|
||||
},
|
||||
{
|
||||
setup: "inspect #someid",
|
||||
|
@ -96,6 +71,8 @@ add_task(function* () {
|
|||
selector: { message: "" },
|
||||
}
|
||||
},
|
||||
exec: {},
|
||||
post: () => checkSelection("#someid"),
|
||||
},
|
||||
{
|
||||
setup: "inspect button[disabled]",
|
||||
|
@ -108,6 +85,8 @@ add_task(function* () {
|
|||
selector: { message: "" },
|
||||
}
|
||||
},
|
||||
exec: {},
|
||||
post: () => checkSelection("button[disabled]"),
|
||||
},
|
||||
{
|
||||
setup: "inspect p>strong",
|
||||
|
@ -120,6 +99,8 @@ add_task(function* () {
|
|||
selector: { message: "" },
|
||||
}
|
||||
},
|
||||
exec: {},
|
||||
post: () => checkSelection("p>strong"),
|
||||
},
|
||||
{
|
||||
setup: "inspect :root",
|
||||
|
@ -129,7 +110,9 @@ add_task(function* () {
|
|||
markup: "VVVVVVVVVVVVV",
|
||||
status: "VALID"
|
||||
},
|
||||
exec: {},
|
||||
post: () => checkSelection(":root"),
|
||||
},
|
||||
]);
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче