///
import "jquery";
import "jquery.terminal";
function test_type(x: T) {};
// -----------------------------------------------------------------------------
// :: instance
// -----------------------------------------------------------------------------
$('.term').terminal(function(command, term) {
});
$('.term').terminal(function(command) {
});
$('.term').terminal([function(command, term) {
return Promise.resolve(document.createElement('div'));
}]);
$('.term').terminal("foo.php");
$('.term').terminal(["foo.php"]);
var obj_interpreter: JQueryTerminal.ObjectInterpreter = {
foo: function(...args) {
return $('');
},
bar: function(a, b) {
// user should typecheck the arguments in JavaScript
(a).test('x');
return Promise.resolve("foo");
},
baz: {
a: function() {
return document.createElement('canvas');
},
b: {
c: function() {
return "xxx";
}
}
}
};
$('.term').terminal([obj_interpreter]);
$('.term').terminal(["foo.php", obj_interpreter]);
$('.term').terminal(["foo.php", obj_interpreter, function(command) {
}]);
class Foo {
x: string;
constructor(x: string) {
this.x = x;
}
}
// -----------------------------------------------------------------------------
// :: formatters
// -----------------------------------------------------------------------------
$.terminal.nested_formatting.__inherit__ = true;
$.terminal.nested_formatting.__warn__ = true;
$.terminal.nested_formatting.__meta__ = true;
$.terminal.defaults.formatters.push([/foo/g, 'bar']);
$.terminal.defaults.formatters.push([/foo/g, 'bar', {echo: true, command: true}]);
$.terminal.defaults.formatters.push(function(str: string) {
return str.replace(/foo/g, 'bar');
});
function red(str: string) {
return '[[;red;]' + str + ']';
}
red.__inerit__ = true;
$.terminal.defaults.formatters.push(red);
// -----------------------------------------------------------------------------
// :: Options
// -----------------------------------------------------------------------------
(function() {
// -------------------------------------------------------------------------
// :: prompt
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
prompt: function() {
return Promise.resolve(">>> ");
}
});
$('.term').terminal($.noop, {
prompt: ">>> "
});
$('.term').terminal($.noop, {
prompt: function(cb) {
cb(">>> ");
console.log(this.get_command());
}
});
// -------------------------------------------------------------------------
// :: keymap
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
keymap: {
'CTRL+C': function(e, original) {
console.log(e.target);
original(e);
}
}
});
// -------------------------------------------------------------------------
// :: exceptionHandler
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
exceptionHandler: function(e, label) {
test_type(this);
this.error(e.message);
}
});
// -------------------------------------------------------------------------
// :: onCommandChange
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
onCommandChange: function(command) {
test_type(this);
test_type(command);
}
});
// -------------------------------------------------------------------------
// :: processRPCResponse
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
processRPCResponse: function(data) {
data.result = 10;
}
});
// -------------------------------------------------------------------------
// :: greetings
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
greetings: "hello"
});
$('.term').terminal($.noop, {
greetings: null
});
$('.term').terminal($.noop, {
greetings: function(cb) {
cb("hello");
}
});
$('.term').terminal($.noop, {
greetings: function() {
console.log(this.get_command());
return Promise.resolve("Hello");
}
});
// -------------------------------------------------------------------------
// :: scrollObject
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
scrollObject: "html"
});
$('.term').terminal($.noop, {
scrollObject: $("body")
});
$('.term').terminal($.noop, {
scrollObject: document.body
});
// -------------------------------------------------------------------------
// :: historyFilter
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
historyFilter: /^ /
});
$('.term').terminal($.noop, {
historyFilter: function(command) {
return !!command.match(/^ /);
}
});
// -------------------------------------------------------------------------
// :: login
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
login: true
});
$('.term').terminal($.noop, {
login: function(username, password) {
return Promise.resolve("TOKEN");
}
});
$('.term').terminal($.noop, {
login: function(username, password, cb) {
cb("TOKEN");
}
});
// -------------------------------------------------------------------------
// :: onAjaxError
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
onAjaxError: function(xhr, status, error) {
xhr.getAllResponseHeaders();
status.charCodeAt(0);
error.charCodeAt(0);
}
});
// -------------------------------------------------------------------------
// :: request
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
request: function(xhr, json, term) {
term.echo("foo");
}
});
$('.term').terminal($.noop, {
request: function(xhr, data) {
data.params.unshift("token");
this.echo(JSON.stringify(data));
var term = this;
xhr.then(function(value) {
term.echo(value);
});
}
});
// -------------------------------------------------------------------------
// :: response
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
response: function(xhr, data) {
data.result = 10;
this.echo(JSON.stringify(data));
var term = this;
xhr.then(function(value) {
term.echo(value);
});
}
});
// -------------------------------------------------------------------------
// :: onRPCError
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
onRPCError: function(error) {
this.echo(error.error.message);
}
});
// -------------------------------------------------------------------------
// :: doubleTab
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
doubleTab: function(str, matched, echo_Command) {
echo_Command();
this.echo(matched.slice(1).concat([str]));
}
});
// -------------------------------------------------------------------------
// :: completion
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
completion: ["foo", "bar", "baz"]
});
$('.term').terminal($.noop, {
completion: function(str, cb) {
str.charCodeAt(0);
cb(["foo", "bar", "baz"]);
}
});
// -------------------------------------------------------------------------
// :: Simple events
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
onInit: function(term) {
this.echo('event');
}
});
$('.term').terminal($.noop, {
onClear: function(term) {
this.echo('event');
}
});
$('.term').terminal($.noop, {
onBlur: function(term) {
this.echo('event');
}
});
$('.term').terminal($.noop, {
onFocus: function(term) {
this.echo('event');
}
});
$('.term').terminal($.noop, {
onExit: function(term) {
this.echo('event');
}
});
$('.term').terminal($.noop, {
onAfterRedraw: function(term) {
this.echo('event');
}
});
$('.term').terminal($.noop, {
onFlush: function(term) {
this.echo('event');
}
});
// -------------------------------------------------------------------------
// :: onPush
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
onPush: function(before, after) {
before.interpreter.call(this, "init", this);
}
});
// -------------------------------------------------------------------------
// :: onPush
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
onPop: function(before, after) {
before.interpreter.call(this, "init", this);
}
});
// -------------------------------------------------------------------------
// :: keypress
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
keypress: function(e) {
this.echo(e.key);
}
});
// -------------------------------------------------------------------------
// :: keydown
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
keydown: function(e) {
this.echo(e.key);
}
});
// -------------------------------------------------------------------------
// :: onEchoCommand
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
onEchoCommand: function(div, command) {
div.css('color', 'red');
this.echo(command.charCodeAt(0).toString());
}
});
// -------------------------------------------------------------------------
// :: renderHandler
// -------------------------------------------------------------------------
$('.term').terminal($.noop, {
renderHandler: function(value) {
// value here is any you should typecheck the value in JS
// and return string, DOM node or jQuery object
if (value instanceof Foo) {
return $('' + value.x + '');
}
if (value === true) {
this.echo('true value');
return false;
}
if (value === false) {
var div = document.createElement('div');
div.innerHTML = 'false value';
return div;
}
}
});
});
// -----------------------------------------------------------------------------
// :: Methods
// -----------------------------------------------------------------------------
(function() {
var term = $('.term').terminal();
// -------------------------------------------------------------------------
// :: id
// -------------------------------------------------------------------------
test_type(term.id());
// -------------------------------------------------------------------------
// :: clear
// -------------------------------------------------------------------------
term.clear().clear();
// -------------------------------------------------------------------------
// :: import/export
// -------------------------------------------------------------------------
term.import_view(term.export_view());
// -------------------------------------------------------------------------
// :: save_state
// -------------------------------------------------------------------------
term.save_state("foo");
term.save_state("foo", true);
term.save_state("foo", undefined, 10);
term.save_state("foo", false, 10);
// -------------------------------------------------------------------------
// :: exec
// -------------------------------------------------------------------------
term.exec("foo");
term.exec("foo", true);
term.exec("foo", true, jQuery.Deferred()).then(function() {
});
// -------------------------------------------------------------------------
// :: autologin
// -------------------------------------------------------------------------
term.autologin("username", "TOKEN").clear();
term.autologin("username", "TOKEN", true).clear();
// -------------------------------------------------------------------------
// :: login
// -------------------------------------------------------------------------
term.login(function(username, password, callback) {
}).clear();
term.login(function(username, password) {
}).clear();
term.login(function(username, password) {
}, true, () => {}).clear();
term.login(function(username, password) {
}, undefined, () => {}).clear();
term.login(function(username, password) {
}, true, () => {}, () => {}).clear();
// -------------------------------------------------------------------------
// :: settings
// -------------------------------------------------------------------------
term.before_cursor().charCodeAt(0);
term.before_cursor(true).charCodeAt(0);
// -------------------------------------------------------------------------
// ::
// -------------------------------------------------------------------------
term.set_interpreter(function(command) {
});
term.set_interpreter(function(command, term) {
});
term.set_interpreter(function(command) {
});
term.set_interpreter([function(command, term) {
}]);
term.set_interpreter("foo.php");
term.set_interpreter(["foo.php"]);
term.set_interpreter([obj_interpreter]);
term.set_interpreter(["foo.php", obj_interpreter]);
term.set_interpreter(["foo.php", obj_interpreter, function(command) {
}]);
term.set_interpreter("foo.php", true);
term.set_interpreter("foo.php", "login");
term.set_interpreter("foo.php", function(user, password) {
});
term.set_interpreter("foo.php", function(user, password, cb) {
cb("Foo");
});
// -------------------------------------------------------------------------
// :: greetings
// -------------------------------------------------------------------------
term.greetings().echo("foo");
// -------------------------------------------------------------------------
// :: paused
// -------------------------------------------------------------------------
test_type(term.paused());
// -------------------------------------------------------------------------
// :: pause
// -------------------------------------------------------------------------
term.pause().echo("foo");
// -------------------------------------------------------------------------
// :: resume
// -------------------------------------------------------------------------
term.resume().echo("foo");
// -------------------------------------------------------------------------
// :: cols
// -------------------------------------------------------------------------
test_type(term.cols());
// -------------------------------------------------------------------------
// :: rows
// -------------------------------------------------------------------------
test_type(term.rows());
// -------------------------------------------------------------------------
// :: history
// -------------------------------------------------------------------------
test_type>(term.history())
// -------------------------------------------------------------------------
// :: history_state
// -------------------------------------------------------------------------
term.history_state(true).echo("foo");
// -------------------------------------------------------------------------
// :: clear_history_state
// -------------------------------------------------------------------------
term.clear_history_state().echo("foo");
// -------------------------------------------------------------------------
// :: next
// -------------------------------------------------------------------------
term.next().echo("foo");
// -------------------------------------------------------------------------
// :: focus
// -------------------------------------------------------------------------
term.focus().echo("foo");
term.focus(true).echo("foo");
// -------------------------------------------------------------------------
// :: freeze
// -------------------------------------------------------------------------
term.freeze().echo("foo");
term.freeze(true).echo("foo");
// -------------------------------------------------------------------------
// :: fronzen
// -------------------------------------------------------------------------
test_type(term.frozen());
// -------------------------------------------------------------------------
// :: enable
// -------------------------------------------------------------------------
term.enable().echo("foo");
term.enable(true);
// -------------------------------------------------------------------------
// :: disable
// -------------------------------------------------------------------------
term.disable().echo("foo");
term.disable(true);
// -------------------------------------------------------------------------
// :: enabled
// -------------------------------------------------------------------------
test_type(term.enabled());
// -------------------------------------------------------------------------
// :: signature
// -------------------------------------------------------------------------
test_type(term.signature());
// -------------------------------------------------------------------------
// :: version
// -------------------------------------------------------------------------
test_type(term.version());
// -------------------------------------------------------------------------
// :: cmd
// -------------------------------------------------------------------------
test_type(term.cmd());
// -------------------------------------------------------------------------
// :: get_command
// -------------------------------------------------------------------------
test_type(term.get_command());
// -------------------------------------------------------------------------
// :: set_command
// -------------------------------------------------------------------------
term.set_command("foo").echo("foo");
term.set_command("foo", true);
// -------------------------------------------------------------------------
// :: get_position
// -------------------------------------------------------------------------
test_type(term.get_position());
// -------------------------------------------------------------------------
// :: insert
// -------------------------------------------------------------------------
test_type(term.insert("foo"));
term.insert("foo", true);
// -------------------------------------------------------------------------
// :: set_prompt
// -------------------------------------------------------------------------
test_type(term.set_prompt(">>> "));
term.set_prompt(function(cb) {
cb(">>> ");
this.get_command();
});
term.set_prompt(function() {
this.get_command();
return Promise.resolve(">>> ");
});
// -------------------------------------------------------------------------
// :: get_prompt
// -------------------------------------------------------------------------
var fn: (cb: (prompt: string) => void) => void = term.get_prompt();
var prompt: string = term.get_prompt();
// -------------------------------------------------------------------------
// :: set_mask
// -------------------------------------------------------------------------
test_type(term.set_mask(true));
term.set_mask("-");
// -------------------------------------------------------------------------
// :: get_output
// -------------------------------------------------------------------------
test_type(term.get_output());
var lines: JQueryTerminal.Lines = term.get_output();
test_type(lines[0].index);
var div = $('');
lines[0].options.finalize.call(term, div);
lines[0].options.onClear.call(term, div);
lines[0].options.unmount.call(term, div);
// -------------------------------------------------------------------------
// :: resize
// -------------------------------------------------------------------------
test_type(term.resize());
term.resize(100);
term.resize(100, 200);
// -------------------------------------------------------------------------
// :: refresh
// -------------------------------------------------------------------------
test_type(term.refresh());
// -------------------------------------------------------------------------
// :: flush
// -------------------------------------------------------------------------
test_type(term.flush());
term.flush({update: true});
term.flush({scroll: true});
// -------------------------------------------------------------------------
// :: update
// -------------------------------------------------------------------------
test_type(term.update(10, ">>>"));
term.update(10, ">>>", {
finalize: function(div) {
div.css('color', 'red');
}
});
// -------------------------------------------------------------------------
// :: remove_line
// -------------------------------------------------------------------------
test_type(term.remove_line(10));
// -------------------------------------------------------------------------
// :: echo
// -------------------------------------------------------------------------
term.echo("foo");
term.echo(["foo", "bar"]);
term.echo(function(): string {
return "foo";
});
term.echo(function(): string[] {
return ["foo", "bar"];
});
term.echo(Promise.resolve("foo"));
term.echo(Promise.resolve(["foo"]));
term.echo(Promise.resolve(function(): string {
return "foo";
}));
term.echo(Promise.resolve(function(): string[] {
return ["foo"];
}));
// add in version 2.9.0
term.echo(document.createElement('div'));
term.echo($(''));
term.echo($(document.createElement('div')));
// special case when Foo class is processed by renderHandler
// this is wordaround since echo can accept anything
term.echo(new Foo('hello'));
// function options
term.echo(document.createElement('canvas'), {
onClear: function(div) {
div.find('canvas');
console.log(this.get_command());
(div[0] as any).pause = true;
},
unmount: function(div) {
div.find('canvas');
console.log(this.get_command());
},
finalize: function(div) {
div.find('canvas');
console.log(this.get_command());
var canvas = (div.find('cavas')[0]);
canvas.width = canvas.height = 100;
var ctx = canvas.getContext("2d");
if (ctx === null) {
return;
}
ctx.clearRect(0, 0, 100, 100);
ctx.fillStyle = "#00FF00";
ctx.fillRect(10, 10, 90, 90);
}
});
// -------------------------------------------------------------------------
// :: error
// -------------------------------------------------------------------------
test_type(term.error("foo"));
term.error(function() {
return "foo";
});
term.error(Promise.resolve("foo"), {
finalize: function(div) {
div.addClass('error-string');
}
});
// -------------------------------------------------------------------------
// :: exception
// -------------------------------------------------------------------------
var e = new $.terminal.Exception("error");
test_type(term.exception(e));
term.exception(e, "ERROR");
// -------------------------------------------------------------------------
// :: scroll
// -------------------------------------------------------------------------
test_type(term.scroll(10));
// -------------------------------------------------------------------------
// :: logout
// -------------------------------------------------------------------------
test_type(term.logout());
term.logout(true);
// -------------------------------------------------------------------------
// :: token
// -------------------------------------------------------------------------
test_type(term.token());
term.token(true);
// -------------------------------------------------------------------------
// :: set_token
// -------------------------------------------------------------------------
test_type(term.set_token("foo"));
term.set_token("foo", true);
// -------------------------------------------------------------------------
// :: get_token
// -------------------------------------------------------------------------
test_type(term.get_token());
term.get_token(true);
// -------------------------------------------------------------------------
// :: login_name
// -------------------------------------------------------------------------
test_type(term.login_name());
term.login_name(true);
// -------------------------------------------------------------------------
// :: name
// -------------------------------------------------------------------------
test_type(term.name());
// -------------------------------------------------------------------------
// :: prefix_name
// -------------------------------------------------------------------------
test_type(term.prefix_name());
test_type(term.prefix_name(true));
// -------------------------------------------------------------------------
// :: read
// -------------------------------------------------------------------------
term.read("foo", function(s) {
s.charCodeAt(0);
}).then(function(s) {
s.charCodeAt(0);
});
// -------------------------------------------------------------------------
// :: push
// -------------------------------------------------------------------------
term.push(function(command) {
});
term.push(function(command, term) {
});
term.push(function(command) {
});
term.push([function(command, term) {
}]);
term.push("foo.php");
term.push(["foo.php"]);
term.push([obj_interpreter]);
term.push(["foo.php", obj_interpreter]);
term.push(["foo.php", obj_interpreter, function(command) {
}]);
term.push("foo", {
login: true
});
term.push("foo", {
infiniteLogin: true
});
term.push("foo", {
prompt: "foo"
});
term.push("foo", {
prompt: function(cb) {
cb("foo");
var s: string = this.get_command();
}
});
term.push("foo", {
login: function(username, password, cb) {
cb('TOKEN');
}
});
term.push("foo", {
completion: ["foo", "bar", "baz"]
});
term.push("foo", {
completion: function(str, cb) {
str.charCodeAt(0);
cb(["foo", "bar", "baz"]);
}
});
// -------------------------------------------------------------------------
// :: pop
// -------------------------------------------------------------------------
test_type(term.pop());
term.pop("foo");
term.pop("foo", true);
// -------------------------------------------------------------------------
// :: option
// -------------------------------------------------------------------------
var option: string = term.option('name');
term.option({
completion: ["foo"]
});
term.option("completion", ["foo"]);
// -------------------------------------------------------------------------
// :: invoke_key
// -------------------------------------------------------------------------
test_type(term.invoke_key("CTRL+C"));
// -------------------------------------------------------------------------
// :: keymap
// -------------------------------------------------------------------------
var keymap_fn: (e: JQueryKeyEventObject) => any = term.keymap('CTRL+K');
var keymap = term.keymap();
keymap['CTRL+C']($.Event("keypress"));
term.keymap("CTRL+C")($.Event("keypress"));
term.keymap("CTRL+C", keymap_fn);
term.keymap(keymap);
// -------------------------------------------------------------------------
// :: level
// -------------------------------------------------------------------------
test_type(term.level());
// -------------------------------------------------------------------------
// :: reset
// -------------------------------------------------------------------------
test_type(term.reset());
// -------------------------------------------------------------------------
// :: purge
// -------------------------------------------------------------------------
test_type(term.purge());
// -------------------------------------------------------------------------
// :: destroy
// -------------------------------------------------------------------------
test_type(term.destroy());
// -------------------------------------------------------------------------
// :: scroll_to_bottom
// -------------------------------------------------------------------------
test_type(term.scroll_to_bottom());
// -------------------------------------------------------------------------
// :: is_bottom
// -------------------------------------------------------------------------
test_type(term.is_bottom());
});
// -----------------------------------------------------------------------------
// :: CMD
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// :: Options
// -----------------------------------------------------------------------------
(function() {
// -------------------------------------------------------------------------
// :: prompt
// -------------------------------------------------------------------------
test_type($('.cmd').cmd());
$('').cmd({
prompt: ">>> "
});
$('').cmd({
prompt: function(cb) {
cb(">>> ");
}
});
// -------------------------------------------------------------------------
// :: onPositionChange
// -------------------------------------------------------------------------
$('.cmd').cmd({
onPositionChange: function(position) {
test_type(position);
}
});
$('.cmd').cmd({
onPositionChange: function(position, display_pos) {
test_type(display_pos);
}
});
// -------------------------------------------------------------------------
// :: historyFilter
// -------------------------------------------------------------------------
$('.cmd').cmd({
historyFilter: /^ /
});
$('.cmd').cmd({
historyFilter: function(command) {
return !!command.match(/^ /);
}
});
// -------------------------------------------------------------------------
// :: commands
// -------------------------------------------------------------------------
$('.cmd').cmd({
commands: function(command) {
test_type(this);
test_type(command);
}
});
// -------------------------------------------------------------------------
// :: onCommandChange
// -------------------------------------------------------------------------
$('.cmd').cmd({
onCommandChange: function(command) {
test_type(this);
test_type(command);
}
});
// -------------------------------------------------------------------------
// :: keypress
// -------------------------------------------------------------------------
$('.cmd').cmd({
keypress: function(e) {
test_type(this);
var name: string = e.target.nodeName;
}
});
// -------------------------------------------------------------------------
// :: keydown
// -------------------------------------------------------------------------
$('.cmd').cmd({
keydown: function(e) {
test_type(this);
var name: string = e.target.nodeName;
}
});
});
// -----------------------------------------------------------------------------
// :: Methods
// -----------------------------------------------------------------------------
(function() {
var cmd = $('.cmd').cmd();
// -------------------------------------------------------------------------
// :: option
// -------------------------------------------------------------------------
test_type(cmd.option("mask", 10));
test_type(cmd.option("mask"));
// -------------------------------------------------------------------------
// :: name
// -------------------------------------------------------------------------
test_type(cmd.name());
test_type(cmd.name("foo"));
// -------------------------------------------------------------------------
// :: purge
// -------------------------------------------------------------------------
test_type(cmd.purge());
// -------------------------------------------------------------------------
// :: history
// -------------------------------------------------------------------------
test_type>(cmd.history());
cmd.history().next();
// -------------------------------------------------------------------------
// :: delete
// -------------------------------------------------------------------------
test_type(cmd.delete(10));
test_type(cmd.delete(10, true));
// -------------------------------------------------------------------------
// :: set
// -------------------------------------------------------------------------
test_type(cmd.set("foo"));
test_type(cmd.set("foo", true));
test_type(cmd.set("foo", true, true));
// -------------------------------------------------------------------------
// :: keymap
// -------------------------------------------------------------------------
var keymap_fn: (e: JQueryKeyEventObject) => any = cmd.keymap('CTRL+K');
var keymap = cmd.keymap();
keymap['CTRL+C']($.Event("keypress"));
cmd.keymap("CTRL+C")($.Event("keypress"));
cmd.keymap("CTRL+C", keymap_fn);
cmd.keymap(keymap);
// -------------------------------------------------------------------------
// :: insert
// -------------------------------------------------------------------------
test_type(cmd.insert("foo"));
test_type(cmd.insert("foo", true));
// -------------------------------------------------------------------------
// :: get
// -------------------------------------------------------------------------
test_type(cmd.get());
// -------------------------------------------------------------------------
// :: commands
// -------------------------------------------------------------------------
cmd.commands()("foo");
test_type(cmd.commands(function(command) {
this.display_position();
test_type(command);
}));
// -------------------------------------------------------------------------
// :: destroy
// -------------------------------------------------------------------------
test_type(cmd.destroy());
// -------------------------------------------------------------------------
// :: prompt
// -------------------------------------------------------------------------
var fn: (cb: (prompt: string) => void) => void = cmd.prompt();
var prompt: string = cmd.prompt();
test_type(cmd.prompt(function(cb) {
this.display_position();
cb(">>> ");
}));
test_type(cmd.prompt(">>> "));
test_type(cmd.prompt(true));
// -------------------------------------------------------------------------
// :: position
// -------------------------------------------------------------------------
test_type(cmd.position());
test_type(cmd.position(10));
test_type(cmd.position(10, true));
// -------------------------------------------------------------------------
// :: refresh
// -------------------------------------------------------------------------
test_type(cmd.refresh());
// -------------------------------------------------------------------------
// :: display_postion
// -------------------------------------------------------------------------
test_type(cmd.display_position());
test_type(cmd.display_position(10));
// -------------------------------------------------------------------------
// :: show
// -------------------------------------------------------------------------
test_type(cmd.show());
// -------------------------------------------------------------------------
// :: resize
// -------------------------------------------------------------------------
test_type(cmd.resize());
test_type(cmd.resize(100));
// -------------------------------------------------------------------------
// :: enable
// -------------------------------------------------------------------------
test_type(cmd.enable());
// -------------------------------------------------------------------------
// :: isenabled
// -------------------------------------------------------------------------
test_type(cmd.isenabled());
// -------------------------------------------------------------------------
// :: disable
// -------------------------------------------------------------------------
test_type(cmd.disable());
test_type(cmd.disable(true));
// -------------------------------------------------------------------------
// :: mask
// -------------------------------------------------------------------------
test_type(cmd.mask(true));
test_type(cmd.mask("-"));
test_type(cmd.mask());
test_type(cmd.mask());
});