зеркало из https://github.com/mozilla/gecko-dev.git
Bug 770156 - GCLI needs a command to return the number of matches for a specified CSS selector. r=miker
This commit is contained in:
Родитель
c77a8de4bd
Коммит
ea49230bd4
|
@ -75,6 +75,7 @@ support-files =
|
|||
[browser_cmd_pref1.js]
|
||||
[browser_cmd_pref2.js]
|
||||
[browser_cmd_pref3.js]
|
||||
[browser_cmd_qsa.js]
|
||||
[browser_cmd_restart.js]
|
||||
[browser_cmd_rulers.js]
|
||||
[browser_cmd_screenshot.js]
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Tests that the qsa commands work as they should.
|
||||
|
||||
const TEST_URI = "data:text/html;charset=utf-8,<body></body>";
|
||||
|
||||
function test() {
|
||||
helpers.addTabWithToolbar(TEST_URI, function(options) {
|
||||
return helpers.audit(options, [
|
||||
{
|
||||
setup: 'qsa',
|
||||
check: {
|
||||
input: 'qsa',
|
||||
hints: ' [query]',
|
||||
markup: 'VVV',
|
||||
status: 'VALID'
|
||||
}
|
||||
},
|
||||
{
|
||||
setup: 'qsa body',
|
||||
check: {
|
||||
input: 'qsa body',
|
||||
hints: '',
|
||||
markup: 'VVVVVVVV',
|
||||
status: 'VALID'
|
||||
}
|
||||
}
|
||||
]);
|
||||
}).then(finish, helpers.handleError);
|
||||
}
|
|
@ -69,6 +69,7 @@ exports.devtoolsModules = [
|
|||
"devtools/shared/gcli/commands/media",
|
||||
"devtools/shared/gcli/commands/pagemod",
|
||||
"devtools/shared/gcli/commands/paintflashing",
|
||||
"devtools/shared/gcli/commands/qsa",
|
||||
"devtools/shared/gcli/commands/restart",
|
||||
"devtools/shared/gcli/commands/rulers",
|
||||
"devtools/shared/gcli/commands/screenshot",
|
||||
|
|
|
@ -21,6 +21,7 @@ DevToolsModules(
|
|||
'media.js',
|
||||
'pagemod.js',
|
||||
'paintflashing.js',
|
||||
'qsa.js',
|
||||
'restart.js',
|
||||
'rulers.js',
|
||||
'screenshot.js',
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const l10n = require("gcli/l10n");
|
||||
|
||||
exports.items = [
|
||||
{
|
||||
item: "command",
|
||||
runAt: "server",
|
||||
name: "qsa",
|
||||
description: l10n.lookup("qsaDesc"),
|
||||
params: [{
|
||||
name: "query",
|
||||
type: "nodelist",
|
||||
description: l10n.lookup("qsaQueryDesc")
|
||||
}],
|
||||
exec: function(args, context) {
|
||||
return args.query.length;
|
||||
}
|
||||
}
|
||||
];
|
|
@ -1557,6 +1557,11 @@ mediaEmulateManual=View the document as if rendered on a device supporting the g
|
|||
mediaEmulateType=The media type to emulate
|
||||
mediaResetDesc=Stop emulating a CSS media type
|
||||
|
||||
# LOCALIZATION NOTE (qsaDesc, qsaQueryDesc)
|
||||
# These strings describe the 'qsa' commands and all available parameters.
|
||||
qsaDesc=Perform querySelectorAll on the current document and return number of matches
|
||||
qsaQueryDesc=CSS selectors separated by comma
|
||||
|
||||
# LOCALIZATION NOTE (injectDesc, injectManual, injectLibraryDesc, injectLoaded,
|
||||
# injectFailed) These strings describe the 'inject' commands and all available
|
||||
# parameters.
|
||||
|
|
Загрузка…
Ссылка в новой задаче