Add test for save and restore cursor

This commit is contained in:
Daniel Imms 2017-07-27 16:35:48 -07:00
parent 604959a319
commit 6ea7758ab1

View File

@ -3,6 +3,21 @@ import { InputHandler } from './InputHandler';
import { wcwidth } from './InputHandler';
describe('InputHandler', () => {
describe('save and restore cursor', () => {
let terminal = { buffer: { x: 1, y: 2 } };
let inputHandler = new InputHandler(terminal);
// Save cursor position
inputHandler.saveCursor([]);
assert.equal(terminal.buffer.x, 1);
assert.equal(terminal.buffer.y, 2);
// Change cursor position
terminal.buffer.x = 10;
terminal.buffer.y = 20;
// Restore cursor position
inputHandler.restoreCursor([]);
assert.equal(terminal.buffer.x, 1);
assert.equal(terminal.buffer.y, 2);
});
describe('setCursorStyle', () => {
it('should call Terminal.setOption with correct params', () => {
let options = {};