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-testNode.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: var nodetype = require('gcli/types/node'); michael@0: michael@0: exports.setup = function(options) { michael@0: if (options.window) { michael@0: nodetype.setDocument(options.window.document); michael@0: } michael@0: }; michael@0: michael@0: exports.shutdown = function(options) { michael@0: nodetype.unsetDocument(); michael@0: }; michael@0: michael@0: exports.testNode = function(options) { michael@0: return helpers.audit(options, [ michael@0: { michael@0: setup: 'tse ', michael@0: check: { michael@0: input: 'tse ', michael@0: hints: ' [options]', michael@0: markup: 'VVVV', michael@0: cursor: 4, michael@0: current: 'node', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { status: 'INCOMPLETE' }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse :', michael@0: check: { michael@0: input: 'tse :', michael@0: hints: ' [options]', michael@0: markup: 'VVVVE', michael@0: cursor: 5, michael@0: current: 'node', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { michael@0: arg: ' :', michael@0: status: 'ERROR', michael@0: message: 'Syntax error in CSS query' michael@0: }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse #', michael@0: check: { michael@0: input: 'tse #', michael@0: hints: ' [options]', michael@0: markup: 'VVVVE', michael@0: cursor: 5, michael@0: current: 'node', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { michael@0: value: undefined, michael@0: arg: ' #', michael@0: status: 'ERROR', michael@0: message: 'Syntax error in CSS query' michael@0: }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse .', michael@0: check: { michael@0: input: 'tse .', michael@0: hints: ' [options]', michael@0: markup: 'VVVVE', michael@0: cursor: 5, michael@0: current: 'node', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { michael@0: value: undefined, michael@0: arg: ' .', michael@0: status: 'ERROR', michael@0: message: 'Syntax error in CSS query' michael@0: }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse *', michael@0: check: { michael@0: input: 'tse *', michael@0: hints: ' [options]', michael@0: markup: 'VVVVE', michael@0: cursor: 5, michael@0: current: 'node', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { michael@0: value: undefined, michael@0: arg: ' *', michael@0: status: 'ERROR' michael@0: // message: 'Too many matches (128)' michael@0: }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testNodeDom = function(options) { michael@0: var requisition = options.requisition; michael@0: michael@0: return helpers.audit(options, [ michael@0: { michael@0: skipRemainingIf: options.isNoDom, michael@0: setup: 'tse :root', michael@0: check: { michael@0: input: 'tse :root', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVV', michael@0: cursor: 9, michael@0: current: 'node', michael@0: status: 'VALID', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { arg: ' :root', status: 'VALID' }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse :root ', michael@0: check: { michael@0: input: 'tse :root ', michael@0: hints: '[options]', michael@0: markup: 'VVVVVVVVVV', michael@0: cursor: 10, michael@0: current: 'node', michael@0: status: 'VALID', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { arg: ' :root ', status: 'VALID' }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: }, michael@0: post: function() { michael@0: assert.is(requisition.getAssignment('node').value.tagName, michael@0: 'HTML', michael@0: 'root id'); michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse #gcli-nomatch', michael@0: check: { michael@0: input: 'tse #gcli-nomatch', michael@0: hints: ' [options]', michael@0: markup: 'VVVVIIIIIIIIIIIII', michael@0: cursor: 17, michael@0: current: 'node', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { michael@0: value: undefined, michael@0: arg: ' #gcli-nomatch', michael@0: status: 'INCOMPLETE', michael@0: message: 'No matches' michael@0: }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: } michael@0: } michael@0: ]); michael@0: }; michael@0: michael@0: exports.testNodes = function(options) { michael@0: var requisition = options.requisition; michael@0: michael@0: return helpers.audit(options, [ michael@0: { michael@0: skipRemainingIf: options.isNoDom, michael@0: setup: 'tse :root --nodes *', michael@0: check: { michael@0: input: 'tse :root --nodes *', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVVVVVVVVVVVV', michael@0: current: 'nodes', michael@0: status: 'VALID', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { arg: ' :root', status: 'VALID' }, michael@0: nodes: { arg: ' --nodes *', status: 'VALID' }, michael@0: nodes2: { status: 'VALID' } michael@0: } michael@0: }, michael@0: post: function() { michael@0: assert.is(requisition.getAssignment('node').value.tagName, michael@0: 'HTML', michael@0: '#gcli-input id'); michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse :root --nodes2 div', michael@0: check: { michael@0: input: 'tse :root --nodes2 div', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVVVVVVVVVVVVVVV', michael@0: cursor: 22, michael@0: current: 'nodes2', michael@0: status: 'VALID', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { arg: ' :root', status: 'VALID' }, michael@0: nodes: { status: 'VALID' }, michael@0: nodes2: { arg: ' --nodes2 div', status: 'VALID' } michael@0: } michael@0: }, michael@0: post: function() { michael@0: assert.is(requisition.getAssignment('node').value.tagName, michael@0: 'HTML', michael@0: 'root id'); michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse --nodes ffff', michael@0: check: { michael@0: input: 'tse --nodes ffff', michael@0: hints: ' [options]', michael@0: markup: 'VVVVIIIIIIIVIIII', michael@0: cursor: 16, michael@0: current: 'nodes', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE' michael@0: }, michael@0: nodes: { michael@0: value: undefined, michael@0: arg: ' --nodes ffff', michael@0: status: 'INCOMPLETE', michael@0: message: 'No matches' michael@0: }, michael@0: nodes2: { arg: '', status: 'VALID', message: '' } michael@0: } michael@0: }, michael@0: post: function() { michael@0: /* michael@0: assert.is(requisition.getAssignment('nodes2').value.constructor.name, michael@0: 'NodeList', michael@0: '#gcli-input id'); michael@0: */ michael@0: } michael@0: }, michael@0: { michael@0: setup: 'tse --nodes2 ffff', michael@0: check: { michael@0: input: 'tse --nodes2 ffff', michael@0: hints: ' [options]', michael@0: markup: 'VVVVVVVVVVVVVVVVV', michael@0: cursor: 17, michael@0: current: 'nodes2', michael@0: status: 'ERROR', michael@0: args: { michael@0: command: { name: 'tse' }, michael@0: node: { michael@0: value: undefined, michael@0: arg: '', michael@0: status: 'INCOMPLETE' michael@0: }, michael@0: nodes: { arg: '', status: 'VALID', message: '' }, michael@0: nodes2: { arg: ' --nodes2 ffff', status: 'VALID', message: '' } michael@0: } michael@0: }, michael@0: post: function() { michael@0: /* michael@0: assert.is(requisition.getAssignment('nodes').value.constructor.name, michael@0: 'NodeList', michael@0: '#gcli-input id'); michael@0: assert.is(requisition.getAssignment('nodes2').value.constructor.name, michael@0: 'NodeList', michael@0: '#gcli-input id'); michael@0: */ michael@0: } michael@0: }, michael@0: ]); michael@0: };