1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/commandline/test/browser_gcli_completion2.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,279 @@ 1.4 +/* 1.5 + * Copyright 2012, Mozilla Foundation and contributors 1.6 + * 1.7 + * Licensed under the Apache License, Version 2.0 (the "License"); 1.8 + * you may not use this file except in compliance with the License. 1.9 + * You may obtain a copy of the License at 1.10 + * 1.11 + * http://www.apache.org/licenses/LICENSE-2.0 1.12 + * 1.13 + * Unless required by applicable law or agreed to in writing, software 1.14 + * distributed under the License is distributed on an "AS IS" BASIS, 1.15 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1.16 + * See the License for the specific language governing permissions and 1.17 + * limitations under the License. 1.18 + */ 1.19 + 1.20 +'use strict'; 1.21 +// <INJECTED SOURCE:START> 1.22 + 1.23 +// THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT 1.24 +// DO NOT EDIT IT DIRECTLY 1.25 + 1.26 +var exports = {}; 1.27 + 1.28 +var TEST_URI = "data:text/html;charset=utf-8,<p id='gcli-input'>gcli-testCompletion2.js</p>"; 1.29 + 1.30 +function test() { 1.31 + return Task.spawn(function() { 1.32 + let options = yield helpers.openTab(TEST_URI); 1.33 + yield helpers.openToolbar(options); 1.34 + gcli.addItems(mockCommands.items); 1.35 + 1.36 + yield helpers.runTests(options, exports); 1.37 + 1.38 + gcli.removeItems(mockCommands.items); 1.39 + yield helpers.closeToolbar(options); 1.40 + yield helpers.closeTab(options); 1.41 + }).then(finish, helpers.handleError); 1.42 +} 1.43 + 1.44 +// <INJECTED SOURCE:END> 1.45 + 1.46 +// var helpers = require('./helpers'); 1.47 + 1.48 +exports.testLong = function(options) { 1.49 + return helpers.audit(options, [ 1.50 + { 1.51 + setup: 'tslong --sel', 1.52 + check: { 1.53 + input: 'tslong --sel', 1.54 + hints: ' <selection> <msg> [options]', 1.55 + markup: 'VVVVVVVIIIII' 1.56 + } 1.57 + }, 1.58 + { 1.59 + setup: 'tslong --sel<TAB>', 1.60 + check: { 1.61 + input: 'tslong --sel ', 1.62 + hints: 'space <msg> [options]', 1.63 + markup: 'VVVVVVVIIIIIV' 1.64 + } 1.65 + }, 1.66 + { 1.67 + setup: 'tslong --sel ', 1.68 + check: { 1.69 + input: 'tslong --sel ', 1.70 + hints: 'space <msg> [options]', 1.71 + markup: 'VVVVVVVIIIIIV' 1.72 + } 1.73 + }, 1.74 + { 1.75 + setup: 'tslong --sel s', 1.76 + check: { 1.77 + input: 'tslong --sel s', 1.78 + hints: 'pace <msg> [options]', 1.79 + markup: 'VVVVVVVIIIIIVI' 1.80 + } 1.81 + }, 1.82 + { 1.83 + setup: 'tslong --num ', 1.84 + check: { 1.85 + input: 'tslong --num ', 1.86 + hints: '<number> <msg> [options]', 1.87 + markup: 'VVVVVVVIIIIIV' 1.88 + } 1.89 + }, 1.90 + { 1.91 + setup: 'tslong --num 42', 1.92 + check: { 1.93 + input: 'tslong --num 42', 1.94 + hints: ' <msg> [options]', 1.95 + markup: 'VVVVVVVVVVVVVVV' 1.96 + } 1.97 + }, 1.98 + { 1.99 + setup: 'tslong --num 42 ', 1.100 + check: { 1.101 + input: 'tslong --num 42 ', 1.102 + hints: '<msg> [options]', 1.103 + markup: 'VVVVVVVVVVVVVVVV' 1.104 + } 1.105 + }, 1.106 + { 1.107 + setup: 'tslong --num 42 --se', 1.108 + check: { 1.109 + input: 'tslong --num 42 --se', 1.110 + hints: 'l <msg> [options]', 1.111 + markup: 'VVVVVVVVVVVVVVVVIIII' 1.112 + } 1.113 + }, 1.114 + { 1.115 + setup: 'tslong --num 42 --se<TAB>', 1.116 + check: { 1.117 + input: 'tslong --num 42 --sel ', 1.118 + hints: 'space <msg> [options]', 1.119 + markup: 'VVVVVVVVVVVVVVVVIIIIIV' 1.120 + } 1.121 + }, 1.122 + { 1.123 + setup: 'tslong --num 42 --se<TAB><TAB>', 1.124 + check: { 1.125 + input: 'tslong --num 42 --sel space ', 1.126 + hints: '<msg> [options]', 1.127 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV' 1.128 + } 1.129 + }, 1.130 + { 1.131 + setup: 'tslong --num 42 --sel ', 1.132 + check: { 1.133 + input: 'tslong --num 42 --sel ', 1.134 + hints: 'space <msg> [options]', 1.135 + markup: 'VVVVVVVVVVVVVVVVIIIIIV' 1.136 + } 1.137 + }, 1.138 + { 1.139 + setup: 'tslong --num 42 --sel space ', 1.140 + check: { 1.141 + input: 'tslong --num 42 --sel space ', 1.142 + hints: '<msg> [options]', 1.143 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVVV' 1.144 + } 1.145 + } 1.146 + ]); 1.147 +}; 1.148 + 1.149 +exports.testNoTab = function(options) { 1.150 + return helpers.audit(options, [ 1.151 + { 1.152 + setup: 'tss<TAB>', 1.153 + check: { 1.154 + input: 'tss ', 1.155 + markup: 'VVVV', 1.156 + hints: '' 1.157 + } 1.158 + }, 1.159 + { 1.160 + setup: 'tss<TAB><TAB>', 1.161 + check: { 1.162 + input: 'tss ', 1.163 + markup: 'VVVV', 1.164 + hints: '' 1.165 + } 1.166 + }, 1.167 + { 1.168 + setup: 'xxxx', 1.169 + check: { 1.170 + input: 'xxxx', 1.171 + markup: 'EEEE', 1.172 + hints: '' 1.173 + } 1.174 + }, 1.175 + { 1.176 + skipIf: options.isNoDom, 1.177 + name: '<TAB>', 1.178 + setup: function() { 1.179 + // Doing it this way avoids clearing the input buffer 1.180 + return helpers.pressTab(options); 1.181 + }, 1.182 + check: { 1.183 + input: 'xxxx', 1.184 + markup: 'EEEE', 1.185 + hints: '' 1.186 + } 1.187 + } 1.188 + ]); 1.189 +}; 1.190 + 1.191 +exports.testOutstanding = function(options) { 1.192 + // See bug 779800 1.193 + /* 1.194 + return helpers.audit(options, [ 1.195 + { 1.196 + setup: 'tsg --txt1 ddd ', 1.197 + check: { 1.198 + input: 'tsg --txt1 ddd ', 1.199 + hints: 'aaa [options]', 1.200 + markup: 'VVVVVVVVVVVVVVV' 1.201 + } 1.202 + }, 1.203 + ]); 1.204 + */ 1.205 +}; 1.206 + 1.207 +exports.testCompleteIntoOptional = function(options) { 1.208 + // From bug 779816 1.209 + return helpers.audit(options, [ 1.210 + { 1.211 + setup: 'tso ', 1.212 + check: { 1.213 + typed: 'tso ', 1.214 + hints: '[text]', 1.215 + markup: 'VVVV', 1.216 + status: 'VALID' 1.217 + } 1.218 + }, 1.219 + { 1.220 + setup: 'tso<TAB>', 1.221 + check: { 1.222 + typed: 'tso ', 1.223 + hints: '[text]', 1.224 + markup: 'VVVV', 1.225 + status: 'VALID' 1.226 + } 1.227 + } 1.228 + ]); 1.229 +}; 1.230 + 1.231 +exports.testSpaceComplete = function(options) { 1.232 + return helpers.audit(options, [ 1.233 + { 1.234 + setup: 'tslong --sel2 wit', 1.235 + check: { 1.236 + input: 'tslong --sel2 wit', 1.237 + hints: 'h space <msg> [options]', 1.238 + markup: 'VVVVVVVIIIIIIVIII', 1.239 + cursor: 17, 1.240 + current: 'sel2', 1.241 + status: 'ERROR', 1.242 + tooltipState: 'true:importantFieldFlag', 1.243 + args: { 1.244 + command: { name: 'tslong' }, 1.245 + msg: { status: 'INCOMPLETE' }, 1.246 + num: { status: 'VALID' }, 1.247 + sel: { status: 'VALID' }, 1.248 + bool: { value: false, status: 'VALID' }, 1.249 + num2: { status: 'VALID' }, 1.250 + bool2: { value: false, status: 'VALID' }, 1.251 + sel2: { arg: ' --sel2 wit', status: 'INCOMPLETE' } 1.252 + } 1.253 + } 1.254 + }, 1.255 + { 1.256 + setup: 'tslong --sel2 wit<TAB>', 1.257 + check: { 1.258 + input: 'tslong --sel2 \'with space\' ', 1.259 + hints: '<msg> [options]', 1.260 + markup: 'VVVVVVVVVVVVVVVVVVVVVVVVVVV', 1.261 + cursor: 27, 1.262 + current: 'sel2', 1.263 + status: 'ERROR', 1.264 + tooltipState: 'true:importantFieldFlag', 1.265 + args: { 1.266 + command: { name: 'tslong' }, 1.267 + msg: { status: 'INCOMPLETE' }, 1.268 + num: { status: 'VALID' }, 1.269 + sel: { status: 'VALID' }, 1.270 + bool: { value: false, status: 'VALID' }, 1.271 + num2: { status: 'VALID' }, 1.272 + bool2: { value: false, status: 'VALID' }, 1.273 + sel2: { 1.274 + value: 'with space', 1.275 + arg: ' --sel2 \'with space\' ', 1.276 + status: 'VALID' 1.277 + } 1.278 + } 1.279 + } 1.280 + } 1.281 + ]); 1.282 +};