mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Add first headless test
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ const Terminal = require('../lib-headless/xterm.js').Terminal;
|
||||
|
||||
console.log('Creating xterm-core terminal...');
|
||||
const terminal = new Terminal();
|
||||
console.log('Writing `ls` to terminal...')
|
||||
console.log('Writing to terminal...')
|
||||
terminal.write('foo \x1b[1;31mbar\x1b[0m baz', () => {
|
||||
const bufferLine = terminal.buffer.normal.getLine(terminal.buffer.normal.cursorY);
|
||||
const contents = bufferLine.translateToString(true);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Copyright (c) 2016 The xterm.js authors. All rights reserved.
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import { deepStrictEqual, throws } from 'assert';
|
||||
import { Terminal } from 'headless/public/Terminal';
|
||||
|
||||
const INIT_COLS = 80;
|
||||
const INIT_ROWS = 24;
|
||||
|
||||
describe('Headless Terminal', () => {
|
||||
let term: Terminal;
|
||||
const termOptions = {
|
||||
cols: INIT_COLS,
|
||||
rows: INIT_ROWS
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
term = new Terminal(termOptions);
|
||||
});
|
||||
|
||||
it('should throw when trying to change cols or rows', () => {
|
||||
throws(() => term.setOption('cols', 1000));
|
||||
throws(() => term.setOption('rows', 1000));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user