browser_gcli_node.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. /*
  2. * Copyright 2012, Mozilla Foundation and contributors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. "use strict";
  17. // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
  18. // PLEASE TALK TO SOMEONE IN DEVELOPER TOOLS BEFORE EDITING IT
  19. const exports = {};
  20. function test() {
  21. helpers.runTestModule(exports, "browser_gcli_node.js");
  22. }
  23. // var assert = require('../testharness/assert');
  24. // var helpers = require('./helpers');
  25. exports.testNode = function (options) {
  26. return helpers.audit(options, [
  27. {
  28. setup: "tse ",
  29. check: {
  30. input: "tse ",
  31. hints: "<node> [options]",
  32. markup: "VVVV",
  33. cursor: 4,
  34. current: "node",
  35. status: "ERROR",
  36. args: {
  37. command: { name: "tse" },
  38. node: { status: "INCOMPLETE" },
  39. nodes: { status: "VALID" },
  40. nodes2: { status: "VALID" }
  41. }
  42. }
  43. },
  44. {
  45. setup: "tse :",
  46. check: {
  47. input: "tse :",
  48. hints: " [options]",
  49. markup: "VVVVE",
  50. cursor: 5,
  51. current: "node",
  52. status: "ERROR",
  53. args: {
  54. command: { name: "tse" },
  55. node: {
  56. arg: " :",
  57. status: "ERROR",
  58. message: "Syntax error in CSS query"
  59. },
  60. nodes: { status: "VALID" },
  61. nodes2: { status: "VALID" }
  62. }
  63. }
  64. },
  65. {
  66. setup: "tse #",
  67. check: {
  68. input: "tse #",
  69. hints: " [options]",
  70. markup: "VVVVE",
  71. cursor: 5,
  72. current: "node",
  73. status: "ERROR",
  74. args: {
  75. command: { name: "tse" },
  76. node: {
  77. value: undefined,
  78. arg: " #",
  79. status: "ERROR",
  80. message: "Syntax error in CSS query"
  81. },
  82. nodes: { status: "VALID" },
  83. nodes2: { status: "VALID" }
  84. }
  85. }
  86. },
  87. {
  88. setup: "tse .",
  89. check: {
  90. input: "tse .",
  91. hints: " [options]",
  92. markup: "VVVVE",
  93. cursor: 5,
  94. current: "node",
  95. status: "ERROR",
  96. args: {
  97. command: { name: "tse" },
  98. node: {
  99. value: undefined,
  100. arg: " .",
  101. status: "ERROR",
  102. message: "Syntax error in CSS query"
  103. },
  104. nodes: { status: "VALID" },
  105. nodes2: { status: "VALID" }
  106. }
  107. }
  108. },
  109. {
  110. setup: "tse *",
  111. check: {
  112. input: "tse *",
  113. hints: " [options]",
  114. markup: "VVVVE",
  115. cursor: 5,
  116. current: "node",
  117. status: "ERROR",
  118. args: {
  119. command: { name: "tse" },
  120. node: {
  121. value: undefined,
  122. arg: " *",
  123. status: "ERROR"
  124. // message: 'Too many matches (128)'
  125. },
  126. nodes: { status: "VALID" },
  127. nodes2: { status: "VALID" }
  128. }
  129. }
  130. }
  131. ]);
  132. };
  133. exports.testNodeDom = function (options) {
  134. return helpers.audit(options, [
  135. {
  136. setup: "tse :root",
  137. check: {
  138. input: "tse :root",
  139. hints: " [options]",
  140. markup: "VVVVVVVVV",
  141. cursor: 9,
  142. current: "node",
  143. status: "VALID",
  144. args: {
  145. command: { name: "tse" },
  146. node: { arg: " :root", status: "VALID" },
  147. nodes: { status: "VALID" },
  148. nodes2: { status: "VALID" }
  149. }
  150. }
  151. },
  152. {
  153. setup: "tse :root ",
  154. check: {
  155. input: "tse :root ",
  156. hints: "[options]",
  157. markup: "VVVVVVVVVV",
  158. cursor: 10,
  159. current: "node",
  160. status: "VALID",
  161. args: {
  162. command: { name: "tse" },
  163. node: { arg: " :root ", status: "VALID" },
  164. nodes: { status: "VALID" },
  165. nodes2: { status: "VALID" }
  166. }
  167. },
  168. exec: {
  169. },
  170. post: function (output) {
  171. if (!options.isRemote) {
  172. assert.is(output.args.node.tagName, "HTML", ":root tagName");
  173. }
  174. }
  175. },
  176. {
  177. setup: "tse #gcli-nomatch",
  178. check: {
  179. input: "tse #gcli-nomatch",
  180. hints: " [options]",
  181. markup: "VVVVIIIIIIIIIIIII",
  182. cursor: 17,
  183. current: "node",
  184. status: "ERROR",
  185. args: {
  186. command: { name: "tse" },
  187. node: {
  188. value: undefined,
  189. arg: " #gcli-nomatch",
  190. status: "INCOMPLETE",
  191. message: "No matches"
  192. },
  193. nodes: { status: "VALID" },
  194. nodes2: { status: "VALID" }
  195. }
  196. }
  197. }
  198. ]);
  199. };
  200. exports.testNodes = function (options) {
  201. return helpers.audit(options, [
  202. {
  203. setup: "tse :root --nodes *",
  204. check: {
  205. input: "tse :root --nodes *",
  206. hints: " [options]",
  207. markup: "VVVVVVVVVVVVVVVVVVV",
  208. current: "nodes",
  209. status: "VALID",
  210. args: {
  211. command: { name: "tse" },
  212. node: { arg: " :root", status: "VALID" },
  213. nodes: { arg: " --nodes *", status: "VALID" },
  214. nodes2: { status: "VALID" }
  215. }
  216. },
  217. exec: {
  218. },
  219. post: function (output) {
  220. if (!options.isRemote) {
  221. assert.is(output.args.node.tagName, "HTML", ":root tagName");
  222. assert.ok(output.args.nodes.length > 3, "nodes length");
  223. assert.is(output.args.nodes2.length, 0, "nodes2 length");
  224. }
  225. assert.is(output.data.args.node, ":root", "node data");
  226. assert.is(output.data.args.nodes, "*", "nodes data");
  227. assert.is(output.data.args.nodes2, "Error", "nodes2 data");
  228. }
  229. },
  230. {
  231. setup: "tse :root --nodes2 div",
  232. check: {
  233. input: "tse :root --nodes2 div",
  234. hints: " [options]",
  235. markup: "VVVVVVVVVVVVVVVVVVVVVV",
  236. cursor: 22,
  237. current: "nodes2",
  238. status: "VALID",
  239. args: {
  240. command: { name: "tse" },
  241. node: { arg: " :root", status: "VALID" },
  242. nodes: { status: "VALID" },
  243. nodes2: { arg: " --nodes2 div", status: "VALID" }
  244. }
  245. },
  246. exec: {
  247. },
  248. post: function (output) {
  249. if (!options.isRemote) {
  250. assert.is(output.args.node.tagName, "HTML", ":root tagName");
  251. assert.is(output.args.nodes.length, 0, "nodes length");
  252. assert.is(output.args.nodes2.item(0).tagName, "DIV", "div tagName");
  253. }
  254. assert.is(output.data.args.node, ":root", "node data");
  255. assert.is(output.data.args.nodes, "Error", "nodes data");
  256. assert.is(output.data.args.nodes2, "div", "nodes2 data");
  257. }
  258. },
  259. {
  260. setup: "tse --nodes ffff",
  261. check: {
  262. input: "tse --nodes ffff",
  263. hints: " <node> [options]",
  264. markup: "VVVVIIIIIIIVIIII",
  265. cursor: 16,
  266. current: "nodes",
  267. status: "ERROR",
  268. args: {
  269. command: { name: "tse" },
  270. node: {
  271. value: undefined,
  272. arg: "",
  273. status: "INCOMPLETE"
  274. },
  275. nodes: {
  276. value: undefined,
  277. arg: " --nodes ffff",
  278. status: "INCOMPLETE",
  279. message: "No matches"
  280. },
  281. nodes2: { arg: "", status: "VALID", message: "" }
  282. }
  283. }
  284. },
  285. {
  286. setup: "tse --nodes2 ffff",
  287. check: {
  288. input: "tse --nodes2 ffff",
  289. hints: " <node> [options]",
  290. markup: "VVVVVVVVVVVVVVVVV",
  291. cursor: 17,
  292. current: "nodes2",
  293. status: "ERROR",
  294. args: {
  295. command: { name: "tse" },
  296. node: {
  297. value: undefined,
  298. arg: "",
  299. status: "INCOMPLETE"
  300. },
  301. nodes: { arg: "", status: "VALID", message: "" },
  302. nodes2: { arg: " --nodes2 ffff", status: "VALID", message: "" }
  303. }
  304. }
  305. },
  306. ]);
  307. };