michael@0: /* michael@0: * Copyright 2012, Mozilla Foundation and contributors michael@0: * michael@0: * Licensed under the Apache License, Version 2.0 (the "License"); michael@0: * you may not use this file except in compliance with the License. michael@0: * You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, software michael@0: * distributed under the License is distributed on an "AS IS" BASIS, michael@0: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. michael@0: * See the License for the specific language governing permissions and michael@0: * limitations under the License. michael@0: */ michael@0: michael@0: 'use strict'; michael@0: // michael@0: michael@0: // THIS FILE IS GENERATED FROM SOURCE IN THE GCLI PROJECT michael@0: // DO NOT EDIT IT DIRECTLY michael@0: michael@0: var exports = {}; michael@0: michael@0: var TEST_URI = "data:text/html;charset=utf-8,

gcli-testContext.js

"; michael@0: michael@0: function test() { michael@0: return Task.spawn(function() { michael@0: let options = yield helpers.openTab(TEST_URI); michael@0: yield helpers.openToolbar(options); michael@0: gcli.addItems(mockCommands.items); michael@0: michael@0: yield helpers.runTests(options, exports); michael@0: michael@0: gcli.removeItems(mockCommands.items); michael@0: yield helpers.closeToolbar(options); michael@0: yield helpers.closeTab(options); michael@0: }).then(finish, helpers.handleError); michael@0: } michael@0: michael@0: // michael@0: michael@0: // var helpers = require('./helpers'); michael@0: michael@0: exports.testBaseline = function(options) { michael@0: return helpers.audit(options, [ michael@0: // These 3 establish a baseline for comparison when we have used the michael@0: // context command michael@0: { michael@0: setup: 'ext', michael@0: check: { michael@0: input: 'ext', michael@0: hints: ' -> context', michael@0: markup: 'III', michael@0: message: '', michael@0: predictions: [ 'context', 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend' ], michael@0: unassigned: [ ], michael@0: } michael@0: }, michael@0: { michael@0: setup: 'ext test', michael@0: check: { michael@0: input: 'ext test', michael@0: hints: '', michael@0: markup: 'IIIVEEEE', michael@0: status: 'ERROR', michael@0: message: 'Too many arguments', michael@0: unassigned: [ ' test' ], michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsn', michael@0: check: { michael@0: input: 'tsn', michael@0: hints: ' deep down nested cmd', michael@0: markup: 'III', michael@0: cursor: 3, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictionsContains: [ 'tsn deep down nested cmd', 'tsn ext', 'tsn exte' ], michael@0: args: { michael@0: command: { name: 'tsn' }, michael@0: } michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testContext = function(options) { michael@0: return helpers.audit(options, [ michael@0: // Use the 'tsn' context michael@0: { michael@0: setup: 'context tsn', michael@0: check: { michael@0: input: 'context tsn', michael@0: hints: ' deep down nested cmd', michael@0: markup: 'VVVVVVVVVVV', michael@0: message: '', michael@0: predictionsContains: [ 'tsn deep down nested cmd', 'tsn ext', 'tsn exte' ], michael@0: args: { michael@0: command: { name: 'context' }, michael@0: prefix: { michael@0: value: options.requisition.canon.getCommand('tsn'), michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Using tsn as a command prefix' michael@0: } michael@0: }, michael@0: // For comparison with earlier michael@0: { michael@0: setup: 'ext', michael@0: check: { michael@0: input: 'ext', michael@0: hints: ' ', michael@0: markup: 'VVV', michael@0: predictions: [ 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend' ], michael@0: args: { michael@0: command: { name: 'tsn ext' }, michael@0: text: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'ext test', michael@0: check: { michael@0: input: 'ext test', michael@0: hints: '', michael@0: markup: 'VVVVVVVV', michael@0: args: { michael@0: command: { name: 'tsn ext' }, michael@0: text: { michael@0: value: 'test', michael@0: arg: ' test', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Exec: tsnExt text=test' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsn', michael@0: check: { michael@0: input: 'tsn', michael@0: hints: ' deep down nested cmd', michael@0: markup: 'III', michael@0: message: '', michael@0: predictionsContains: [ 'tsn deep down nested cmd', 'tsn ext', 'tsn exte' ], michael@0: args: { michael@0: command: { name: 'tsn' }, michael@0: } michael@0: } michael@0: }, michael@0: // Does it actually work? michael@0: { michael@0: setup: 'tsb true', michael@0: check: { michael@0: input: 'tsb true', michael@0: hints: '', michael@0: markup: 'VVVVVVVV', michael@0: options: [ 'true' ], michael@0: message: '', michael@0: predictions: [ 'true' ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'tsb' }, michael@0: toggle: { value: true, arg: ' true', status: 'VALID', message: '' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: // Bug 866710 - GCLI should allow argument merging for non-string parameters michael@0: setup: 'context tsn ext', michael@0: skip: true michael@0: }, michael@0: { michael@0: setup: 'context "tsn ext"', michael@0: check: { michael@0: input: 'context "tsn ext"', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVV', michael@0: message: '', michael@0: predictions: [ 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend' ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'context' }, michael@0: prefix: { michael@0: value: options.requisition.canon.getCommand('tsn ext'), michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Can\'t use \'tsn ext\' as a prefix because it is not a parent command.', michael@0: error: true michael@0: } michael@0: }, michael@0: /* michael@0: { michael@0: setup: 'context "tsn deep"', michael@0: check: { michael@0: input: 'context "tsn deep"', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVVVVVVV', michael@0: status: 'ERROR', michael@0: message: '', michael@0: predictions: [ 'tsn deep' ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'context' }, michael@0: prefix: { michael@0: value: options.requisition.canon.getCommand('tsn deep'), michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: }, michael@0: exec: { michael@0: output: '' michael@0: } michael@0: }, michael@0: */ michael@0: { michael@0: setup: 'context', michael@0: check: { michael@0: input: 'context', michael@0: hints: ' [prefix]', michael@0: markup: 'VVVVVVV', michael@0: status: 'VALID', michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'context' }, michael@0: prefix: { value: undefined, arg: '', status: 'VALID', message: '' }, michael@0: } michael@0: }, michael@0: exec: { michael@0: output: 'Command prefix is unset', michael@0: type: 'string', michael@0: error: false michael@0: } michael@0: } michael@0: ]); michael@0: };