browser/devtools/commandline/test/browser_gcli_completion2.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:33047e7a6c33
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
17 'use strict';
18 // <INJECTED SOURCE:START>
19
20 // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT
21 // DO NOT EDIT IT DIRECTLY
22
23 var exports = {};
24
25 var TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testCompletion2.js</p>";
26
27 function test() {
28 return Task.spawn(function() {
29 let options = yield helpers.openTab(TEST_URI);
30 yield helpers.openToolbar(options);
31 gcli.addItems(mockCommands.items);
32
33 yield helpers.runTests(options, exports);
34
35 gcli.removeItems(mockCommands.items);
36 yield helpers.closeToolbar(options);
37 yield helpers.closeTab(options);
38 }).then(finish, helpers.handleError);
39 }
40
41 // <INJECTED SOURCE:END>
42
43 // var helpers = require('./helpers');
44
45 exports.testLong = function(options) {
46 return helpers.audit(options, [
47 {
48 setup: 'tslong --sel',
49 check: {
50 input: 'tslong --sel',
51 hints: ' <selection> <msg> [options]',
52 markup: 'VVVVVVVIIIII'
53 }
54 },
55 {
56 setup: 'tslong --sel<TAB>',
57 check: {
58 input: 'tslong --sel ',
59 hints: 'space <msg> [options]',
60 markup: 'VVVVVVVIIIIIV'
61 }
62 },
63 {
64 setup: 'tslong --sel ',
65 check: {
66 input: 'tslong --sel ',
67 hints: 'space <msg> [options]',
68 markup: 'VVVVVVVIIIIIV'
69 }
70 },
71 {
72 setup: 'tslong --sel s',
73 check: {
74 input: 'tslong --sel s',
75 hints: 'pace <msg> [options]',
76 markup: 'VVVVVVVIIIIIVI'
77 }
78 },
79 {
80 setup: 'tslong --num ',
81 check: {
82 input: 'tslong --num ',
83 hints: '<number> <msg> [options]',
84 markup: 'VVVVVVVIIIIIV'
85 }
86 },
87 {
88 setup: 'tslong --num 42',
89 check: {
90 input: 'tslong --num 42',
91 hints: ' <msg> [options]',
92 markup: 'VVVVVVVVVVVVVVV'
93 }
94 },
95 {
96 setup: 'tslong --num 42 ',
97 check: {
98 input: 'tslong --num 42 ',
99 hints: '<msg> [options]',
100 markup: 'VVVVVVVVVVVVVVVV'
101 }
102 },
103 {
104 setup: 'tslong --num 42 --se',
105 check: {
106 input: 'tslong --num 42 --se',
107 hints: 'l <msg> [options]',
108 markup: 'VVVVVVVVVVVVVVVVIIII'
109 }
110 },
111 {
112 setup: 'tslong --num 42 --se<TAB>',
113 check: {
114 input: 'tslong --num 42 --sel ',
115 hints: 'space <msg> [options]',
116 markup: 'VVVVVVVVVVVVVVVVIIIIIV'
117 }
118 },
119 {
120 setup: 'tslong --num 42 --se<TAB><TAB>',
121 check: {
122 input: 'tslong --num 42 --sel space ',
123 hints: '<msg> [options]',
124 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV'
125 }
126 },
127 {
128 setup: 'tslong --num 42 --sel ',
129 check: {
130 input: 'tslong --num 42 --sel ',
131 hints: 'space <msg> [options]',
132 markup: 'VVVVVVVVVVVVVVVVIIIIIV'
133 }
134 },
135 {
136 setup: 'tslong --num 42 --sel space ',
137 check: {
138 input: 'tslong --num 42 --sel space ',
139 hints: '<msg> [options]',
140 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV'
141 }
142 }
143 ]);
144 };
145
146 exports.testNoTab = function(options) {
147 return helpers.audit(options, [
148 {
149 setup: 'tss<TAB>',
150 check: {
151 input: 'tss ',
152 markup: 'VVVV',
153 hints: ''
154 }
155 },
156 {
157 setup: 'tss<TAB><TAB>',
158 check: {
159 input: 'tss ',
160 markup: 'VVVV',
161 hints: ''
162 }
163 },
164 {
165 setup: 'xxxx',
166 check: {
167 input: 'xxxx',
168 markup: 'EEEE',
169 hints: ''
170 }
171 },
172 {
173 skipIf: options.isNoDom,
174 name: '<TAB>',
175 setup: function() {
176 // Doing it this way avoids clearing the input buffer
177 return helpers.pressTab(options);
178 },
179 check: {
180 input: 'xxxx',
181 markup: 'EEEE',
182 hints: ''
183 }
184 }
185 ]);
186 };
187
188 exports.testOutstanding = function(options) {
189 // See bug 779800
190 /*
191 return helpers.audit(options, [
192 {
193 setup: 'tsg --txt1 ddd ',
194 check: {
195 input: 'tsg --txt1 ddd ',
196 hints: 'aaa [options]',
197 markup: 'VVVVVVVVVVVVVVV'
198 }
199 },
200 ]);
201 */
202 };
203
204 exports.testCompleteIntoOptional = function(options) {
205 // From bug 779816
206 return helpers.audit(options, [
207 {
208 setup: 'tso ',
209 check: {
210 typed: 'tso ',
211 hints: '[text]',
212 markup: 'VVVV',
213 status: 'VALID'
214 }
215 },
216 {
217 setup: 'tso<TAB>',
218 check: {
219 typed: 'tso ',
220 hints: '[text]',
221 markup: 'VVVV',
222 status: 'VALID'
223 }
224 }
225 ]);
226 };
227
228 exports.testSpaceComplete = function(options) {
229 return helpers.audit(options, [
230 {
231 setup: 'tslong --sel2 wit',
232 check: {
233 input: 'tslong --sel2 wit',
234 hints: 'h space <msg> [options]',
235 markup: 'VVVVVVVIIIIIIVIII',
236 cursor: 17,
237 current: 'sel2',
238 status: 'ERROR',
239 tooltipState: 'true:importantFieldFlag',
240 args: {
241 command: { name: 'tslong' },
242 msg: { status: 'INCOMPLETE' },
243 num: { status: 'VALID' },
244 sel: { status: 'VALID' },
245 bool: { value: false, status: 'VALID' },
246 num2: { status: 'VALID' },
247 bool2: { value: false, status: 'VALID' },
248 sel2: { arg: ' --sel2 wit', status: 'INCOMPLETE' }
249 }
250 }
251 },
252 {
253 setup: 'tslong --sel2 wit<TAB>',
254 check: {
255 input: 'tslong --sel2 \'with space\' ',
256 hints: '<msg> [options]',
257 markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVV',
258 cursor: 27,
259 current: 'sel2',
260 status: 'ERROR',
261 tooltipState: 'true:importantFieldFlag',
262 args: {
263 command: { name: 'tslong' },
264 msg: { status: 'INCOMPLETE' },
265 num: { status: 'VALID' },
266 sel: { status: 'VALID' },
267 bool: { value: false, status: 'VALID' },
268 num2: { status: 'VALID' },
269 bool2: { value: false, status: 'VALID' },
270 sel2: {
271 value: 'with space',
272 arg: ' --sel2 \'with space\' ',
273 status: 'VALID'
274 }
275 }
276 }
277 }
278 ]);
279 };

mercurial