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-testCli1.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 assert = require('../testharness/assert'); michael@0: // var helpers = require('./helpers'); michael@0: michael@0: exports.testBlank = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: '', michael@0: check: { michael@0: input: '', michael@0: hints: '', michael@0: markup: '', michael@0: cursor: 0, michael@0: current: '__command', michael@0: status: 'ERROR' michael@0: }, michael@0: post: function() { michael@0: assert.is(options.requisition.commandAssignment.value, undefined); michael@0: } michael@0: }, michael@0: { michael@0: setup: ' ', michael@0: check: { michael@0: input: ' ', michael@0: hints: '', michael@0: markup: 'V', michael@0: cursor: 1, michael@0: current: '__command', michael@0: status: 'ERROR' michael@0: }, michael@0: post: function() { michael@0: assert.is(options.requisition.commandAssignment.value, undefined); michael@0: } michael@0: }, michael@0: { michael@0: name: '| ', michael@0: setup: function() { michael@0: return helpers.setInput(options, ' ', 0); michael@0: }, michael@0: check: { michael@0: input: ' ', michael@0: hints: '', michael@0: markup: 'V', michael@0: cursor: 0, michael@0: current: '__command', michael@0: status: 'ERROR' michael@0: }, michael@0: post: function() { michael@0: assert.is(options.requisition.commandAssignment.value, undefined); michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testDelete = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'x', michael@0: check: { michael@0: input: '', michael@0: hints: '', michael@0: markup: '', michael@0: cursor: 0, michael@0: current: '__command', michael@0: status: 'ERROR' michael@0: }, michael@0: post: function() { michael@0: assert.is(options.requisition.commandAssignment.value, undefined); michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testIncompleteMultiMatch = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'tsn ex', michael@0: check: { michael@0: input: 'tsn ex', michael@0: hints: 't', michael@0: markup: 'IIIVII', michael@0: cursor: 6, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictionsContains: [ michael@0: 'tsn ext', 'tsn exte', 'tsn exten', 'tsn extend' michael@0: ] michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testIncompleteSingleMatch = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'tselar', michael@0: check: { michael@0: input: 'tselar', michael@0: hints: 'r', michael@0: markup: 'IIIIII', michael@0: cursor: 6, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictions: [ 'tselarr' ], michael@0: unassigned: [ ] michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testTsv = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'tsv', michael@0: check: { michael@0: input: 'tsv', michael@0: hints: ' ', michael@0: markup: 'VVV', michael@0: cursor: 3, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { arg: '', status: 'INCOMPLETE' }, michael@0: optionValue: { arg: '', status: 'INCOMPLETE' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv ', michael@0: check: { michael@0: input: 'tsv ', michael@0: hints: 'option1 ', michael@0: markup: 'VVVV', michael@0: cursor: 4, michael@0: current: 'optionType', michael@0: status: 'ERROR', michael@0: predictions: [ 'option1', 'option2', 'option3' ], michael@0: unassigned: [ ], michael@0: tooltipState: 'true:importantFieldFlag', michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { arg: '', status: 'INCOMPLETE' }, michael@0: optionValue: { arg: '', status: 'INCOMPLETE' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: name: 'ts|v', michael@0: setup: function() { michael@0: return helpers.setInput(options, 'tsv ', 2); michael@0: }, michael@0: check: { michael@0: input: 'tsv ', michael@0: hints: ' ', michael@0: markup: 'VVVV', michael@0: cursor: 2, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { arg: '', status: 'INCOMPLETE' }, michael@0: optionValue: { arg: '', status: 'INCOMPLETE' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv o', michael@0: check: { michael@0: input: 'tsv o', michael@0: hints: 'ption1 ', michael@0: markup: 'VVVVI', michael@0: cursor: 5, michael@0: current: 'optionType', michael@0: status: 'ERROR', michael@0: predictions: [ 'option1', 'option2', 'option3' ], michael@0: unassigned: [ ], michael@0: tooltipState: 'true:importantFieldFlag', michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: undefined, michael@0: arg: ' o', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionType\'.' michael@0: }, michael@0: optionValue: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionValue\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv option', michael@0: check: { michael@0: input: 'tsv option', michael@0: hints: '1 ', michael@0: markup: 'VVVVIIIIII', michael@0: cursor: 10, michael@0: current: 'optionType', michael@0: status: 'ERROR', michael@0: predictions: [ 'option1', 'option2', 'option3' ], michael@0: unassigned: [ ], michael@0: tooltipState: 'true:importantFieldFlag', michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: undefined, michael@0: arg: ' option', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionType\'.' michael@0: }, michael@0: optionValue: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionValue\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: skipRemainingIf: options.isNoDom, michael@0: name: '|tsv option', michael@0: setup: function() { michael@0: return helpers.setInput(options, 'tsv option', 0); michael@0: }, michael@0: check: { michael@0: input: 'tsv option', michael@0: hints: ' ', michael@0: markup: 'VVVVEEEEEE', michael@0: cursor: 0, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: undefined, michael@0: arg: ' option', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionType\'.' michael@0: }, michael@0: optionValue: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionValue\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv option ', michael@0: check: { michael@0: input: 'tsv option ', michael@0: hints: '', michael@0: markup: 'VVVVEEEEEEV', michael@0: cursor: 11, michael@0: current: 'optionValue', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: tooltipState: 'false:default', michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: undefined, michael@0: arg: ' option ', michael@0: status: 'ERROR', michael@0: message: 'Can\'t use \'option\'.' michael@0: }, michael@0: optionValue: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionValue\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv option1', michael@0: check: { michael@0: input: 'tsv option1', michael@0: hints: ' ', michael@0: markup: 'VVVVVVVVVVV', michael@0: cursor: 11, michael@0: current: 'optionType', michael@0: status: 'ERROR', michael@0: predictions: [ 'option1' ], michael@0: unassigned: [ ], michael@0: tooltipState: 'true:importantFieldFlag', michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: 'string', michael@0: arg: ' option1', michael@0: status: 'VALID', michael@0: message: '' michael@0: }, michael@0: optionValue: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionValue\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv option1 ', michael@0: check: { michael@0: input: 'tsv option1 ', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVV', michael@0: cursor: 12, michael@0: current: 'optionValue', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: 'string', michael@0: arg: ' option1 ', michael@0: status: 'VALID', michael@0: message: '' michael@0: }, michael@0: optionValue: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionValue\'.' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv option2', michael@0: check: { michael@0: input: 'tsv option2', michael@0: hints: ' ', michael@0: markup: 'VVVVVVVVVVV', michael@0: cursor: 11, michael@0: current: 'optionType', michael@0: status: 'ERROR', michael@0: predictions: [ 'option2' ], michael@0: unassigned: [ ], michael@0: tooltipState: 'true:importantFieldFlag', michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: 'number', michael@0: arg: ' option2', michael@0: status: 'VALID', michael@0: message: '' michael@0: }, michael@0: optionValue: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE', michael@0: message: 'Value required for \'optionValue\'.' michael@0: } michael@0: } michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testTsvValues = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'tsv option1 6', michael@0: check: { michael@0: input: 'tsv option1 6', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVV', michael@0: cursor: 13, michael@0: current: 'optionValue', michael@0: status: 'VALID', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: 'string', michael@0: arg: ' option1', michael@0: status: 'VALID', michael@0: message: '' michael@0: }, michael@0: optionValue: { michael@0: arg: ' 6', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tsv option2 6', michael@0: check: { michael@0: input: 'tsv option2 6', michael@0: hints: '', michael@0: markup: 'VVVVVVVVVVVVV', michael@0: cursor: 13, michael@0: current: 'optionValue', michael@0: status: 'VALID', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: args: { michael@0: command: { name: 'tsv' }, michael@0: optionType: { michael@0: value: 'number', michael@0: arg: ' option2', michael@0: status: 'VALID', michael@0: message: '' michael@0: }, michael@0: optionValue: { michael@0: arg: ' 6', michael@0: status: 'VALID', michael@0: message: '' michael@0: } michael@0: } michael@0: } michael@0: }, michael@0: // Delegated remote types can't transfer value types so we only test for michael@0: // the value of 'value' when we're local michael@0: { michael@0: skipIf: options.isRemote, michael@0: setup: 'tsv option1 6', michael@0: check: { michael@0: args: { michael@0: optionValue: { value: '6' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: skipIf: options.isRemote, michael@0: setup: 'tsv option2 6', michael@0: check: { michael@0: args: { michael@0: optionValue: { value: 6 } michael@0: } michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testInvalid = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'zxjq', michael@0: check: { michael@0: input: 'zxjq', michael@0: hints: '', michael@0: markup: 'EEEE', michael@0: cursor: 4, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: tooltipState: 'true:isError' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'zxjq ', michael@0: check: { michael@0: input: 'zxjq ', michael@0: hints: '', michael@0: markup: 'EEEEV', michael@0: cursor: 5, michael@0: current: '__command', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ], michael@0: tooltipState: 'true:isError' michael@0: } michael@0: }, michael@0: { michael@0: setup: 'zxjq one', michael@0: check: { michael@0: input: 'zxjq one', michael@0: hints: '', michael@0: markup: 'EEEEVEEE', michael@0: cursor: 8, michael@0: current: '__unassigned', michael@0: status: 'ERROR', michael@0: predictions: [ ], michael@0: unassigned: [ ' one' ], michael@0: tooltipState: 'true:isError' michael@0: } michael@0: } michael@0: ]); michael@0: };