123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318 |
- /*
- * Copyright 2012, Mozilla Foundation and contributors
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- "use strict";
- // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
- // PLEASE TALK TO SOMEONE IN DEVELOPER TOOLS BEFORE EDITING IT
- const exports = {};
- function test() {
- helpers.runTestModule(exports, "browser_gcli_node.js");
- }
- // var assert = require('../testharness/assert');
- // var helpers = require('./helpers');
- exports.testNode = function (options) {
- return helpers.audit(options, [
- {
- setup: "tse ",
- check: {
- input: "tse ",
- hints: "<node> [options]",
- markup: "VVVV",
- cursor: 4,
- current: "node",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: { status: "INCOMPLETE" },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- }
- },
- {
- setup: "tse :",
- check: {
- input: "tse :",
- hints: " [options]",
- markup: "VVVVE",
- cursor: 5,
- current: "node",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: {
- arg: " :",
- status: "ERROR",
- message: "Syntax error in CSS query"
- },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- }
- },
- {
- setup: "tse #",
- check: {
- input: "tse #",
- hints: " [options]",
- markup: "VVVVE",
- cursor: 5,
- current: "node",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: {
- value: undefined,
- arg: " #",
- status: "ERROR",
- message: "Syntax error in CSS query"
- },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- }
- },
- {
- setup: "tse .",
- check: {
- input: "tse .",
- hints: " [options]",
- markup: "VVVVE",
- cursor: 5,
- current: "node",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: {
- value: undefined,
- arg: " .",
- status: "ERROR",
- message: "Syntax error in CSS query"
- },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- }
- },
- {
- setup: "tse *",
- check: {
- input: "tse *",
- hints: " [options]",
- markup: "VVVVE",
- cursor: 5,
- current: "node",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: {
- value: undefined,
- arg: " *",
- status: "ERROR"
- // message: 'Too many matches (128)'
- },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- }
- }
- ]);
- };
- exports.testNodeDom = function (options) {
- return helpers.audit(options, [
- {
- setup: "tse :root",
- check: {
- input: "tse :root",
- hints: " [options]",
- markup: "VVVVVVVVV",
- cursor: 9,
- current: "node",
- status: "VALID",
- args: {
- command: { name: "tse" },
- node: { arg: " :root", status: "VALID" },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- }
- },
- {
- setup: "tse :root ",
- check: {
- input: "tse :root ",
- hints: "[options]",
- markup: "VVVVVVVVVV",
- cursor: 10,
- current: "node",
- status: "VALID",
- args: {
- command: { name: "tse" },
- node: { arg: " :root ", status: "VALID" },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- },
- exec: {
- },
- post: function (output) {
- if (!options.isRemote) {
- assert.is(output.args.node.tagName, "HTML", ":root tagName");
- }
- }
- },
- {
- setup: "tse #gcli-nomatch",
- check: {
- input: "tse #gcli-nomatch",
- hints: " [options]",
- markup: "VVVVIIIIIIIIIIIII",
- cursor: 17,
- current: "node",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: {
- value: undefined,
- arg: " #gcli-nomatch",
- status: "INCOMPLETE",
- message: "No matches"
- },
- nodes: { status: "VALID" },
- nodes2: { status: "VALID" }
- }
- }
- }
- ]);
- };
- exports.testNodes = function (options) {
- return helpers.audit(options, [
- {
- setup: "tse :root --nodes *",
- check: {
- input: "tse :root --nodes *",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVVVVVV",
- current: "nodes",
- status: "VALID",
- args: {
- command: { name: "tse" },
- node: { arg: " :root", status: "VALID" },
- nodes: { arg: " --nodes *", status: "VALID" },
- nodes2: { status: "VALID" }
- }
- },
- exec: {
- },
- post: function (output) {
- if (!options.isRemote) {
- assert.is(output.args.node.tagName, "HTML", ":root tagName");
- assert.ok(output.args.nodes.length > 3, "nodes length");
- assert.is(output.args.nodes2.length, 0, "nodes2 length");
- }
- assert.is(output.data.args.node, ":root", "node data");
- assert.is(output.data.args.nodes, "*", "nodes data");
- assert.is(output.data.args.nodes2, "Error", "nodes2 data");
- }
- },
- {
- setup: "tse :root --nodes2 div",
- check: {
- input: "tse :root --nodes2 div",
- hints: " [options]",
- markup: "VVVVVVVVVVVVVVVVVVVVVV",
- cursor: 22,
- current: "nodes2",
- status: "VALID",
- args: {
- command: { name: "tse" },
- node: { arg: " :root", status: "VALID" },
- nodes: { status: "VALID" },
- nodes2: { arg: " --nodes2 div", status: "VALID" }
- }
- },
- exec: {
- },
- post: function (output) {
- if (!options.isRemote) {
- assert.is(output.args.node.tagName, "HTML", ":root tagName");
- assert.is(output.args.nodes.length, 0, "nodes length");
- assert.is(output.args.nodes2.item(0).tagName, "DIV", "div tagName");
- }
- assert.is(output.data.args.node, ":root", "node data");
- assert.is(output.data.args.nodes, "Error", "nodes data");
- assert.is(output.data.args.nodes2, "div", "nodes2 data");
- }
- },
- {
- setup: "tse --nodes ffff",
- check: {
- input: "tse --nodes ffff",
- hints: " <node> [options]",
- markup: "VVVVIIIIIIIVIIII",
- cursor: 16,
- current: "nodes",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: {
- value: undefined,
- arg: "",
- status: "INCOMPLETE"
- },
- nodes: {
- value: undefined,
- arg: " --nodes ffff",
- status: "INCOMPLETE",
- message: "No matches"
- },
- nodes2: { arg: "", status: "VALID", message: "" }
- }
- }
- },
- {
- setup: "tse --nodes2 ffff",
- check: {
- input: "tse --nodes2 ffff",
- hints: " <node> [options]",
- markup: "VVVVVVVVVVVVVVVVV",
- cursor: 17,
- current: "nodes2",
- status: "ERROR",
- args: {
- command: { name: "tse" },
- node: {
- value: undefined,
- arg: "",
- status: "INCOMPLETE"
- },
- nodes: { arg: "", status: "VALID", message: "" },
- nodes2: { arg: " --nodes2 ffff", status: "VALID", message: "" }
- }
- }
- },
- ]);
- };
|