Skip to content

Commit

Permalink
Merge 05ca1cb into 2f4c5b9
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed May 26, 2019
2 parents 2f4c5b9 + 05ca1cb commit 47794ee
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
60 changes: 59 additions & 1 deletion src/InputHandler.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const width = 800;
const height = 600;

describe('InputHandler Integration Tests', function(): void {
this.timeout(10000);
this.timeout(20000);

before(async function(): Promise<any> {
browser = await puppeteer.launch({
Expand Down Expand Up @@ -138,6 +138,64 @@ describe('InputHandler Integration Tests', function(): void {
assert.deepEqual(await getLinesAsArray(2), [' a', ' b']);
});

it('ED: Erase in Display, VT100 - CSI Ps J', async function(): Promise<any> {
const fixture = 'abc\\n\\rdef\\n\\rghi\x1b[2;2H';
await page.evaluate(`
// Default: Erase Below
window.term.resize(5, 5);
window.term.write('${fixture}\x1b[J')
`);
assert.deepEqual(await getLinesAsArray(3), ['abc', 'd', '']);
await page.evaluate(`
// 0: Erase Below
window.term.reset()
window.term.write('${fixture}\x1b[0J')
`);
assert.deepEqual(await getLinesAsArray(3), ['abc', 'd', '']);
await page.evaluate(`
// 1: Erase Above
window.term.reset()
window.term.write('${fixture}\x1b[1J')
`);
assert.deepEqual(await getLinesAsArray(3), ['', ' f', 'ghi']);
await page.evaluate(`
// 2: Erase Saved Lines (scrollback)
window.term.reset()
window.term.write('1\\n2\\n3\\n4\\n5${fixture}\x1b[3J')
`);
assert.equal(await page.evaluate(`window.term.buffer.length`), 5);
assert.deepEqual(await getLinesAsArray(5), [' 4', ' 5', 'abc', 'def', 'ghi']);
});

it('DECSED: Erase in Display, VT220 - CSI ? Ps J', async function(): Promise<any> {
const fixture = 'abc\\n\\rdef\\n\\rghi\x1b[2;2H';
await page.evaluate(`
// Default: Erase Below
window.term.resize(5, 5);
window.term.write('${fixture}\x1b[?J')
`);
assert.deepEqual(await getLinesAsArray(3), ['abc', 'd', '']);
await page.evaluate(`
// 0: Erase Below
window.term.reset()
window.term.write('${fixture}\x1b[?0J')
`);
assert.deepEqual(await getLinesAsArray(3), ['abc', 'd', '']);
await page.evaluate(`
// 1: Erase Above
window.term.reset()
window.term.write('${fixture}\x1b[?1J')
`);
assert.deepEqual(await getLinesAsArray(3), ['', ' f', 'ghi']);
await page.evaluate(`
// 2: Erase Saved Lines (scrollback)
window.term.reset()
window.term.write('1\\n2\\n3\\n4\\n5${fixture}\x1b[?3J')
`);
assert.equal(await page.evaluate(`window.term.buffer.length`), 5);
assert.deepEqual(await getLinesAsArray(5), [' 4', ' 5', 'abc', 'def', 'ghi']);
});

describe('DSR: Device Status Report', () => {
it('Status Report - CSI 5 n', async function(): Promise<any> {
await page.evaluate(`
Expand Down
2 changes: 1 addition & 1 deletion src/public/Terminal.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const width = 800;
const height = 600;

describe('API Integration Tests', function(): void {
this.timeout(10000);
this.timeout(20000);

before(async function(): Promise<any> {
browser = await puppeteer.launch({
Expand Down

0 comments on commit 47794ee

Please sign in to comment.