]> git.proxmox.com Git - mirror_xterm.js.git/blob - src/BufferSet.test.ts
2101fbc1f48c033a29f702f102299c83207c94ea
[mirror_xterm.js.git] / src / BufferSet.test.ts
1 /**
2 * @license MIT
3 */
4 import { assert } from 'chai';
5 import { ITerminal } from './Interfaces';
6 import { BufferSet } from './BufferSet';
7 import { Buffer } from './Buffer';
8
9 describe('BufferSet', () => {
10 let terminal: ITerminal;
11 let bufferSet: BufferSet;
12
13 beforeEach(() => {
14 terminal = <any>{
15 cols: 80,
16 rows: 24,
17 scrollback: 1000
18 };
19 bufferSet = new BufferSet(terminal);
20 });
21
22 describe('constructor', () => {
23 it('should create two different buffers: alt and normal', () => {
24 assert.instanceOf(bufferSet.normal, Buffer);
25 assert.instanceOf(bufferSet.alt, Buffer);
26 assert.notEqual(bufferSet.normal, bufferSet.alt);
27 });
28 });
29
30 describe('activateNormalBuffer', () => {
31 beforeEach(() => {
32 bufferSet.activateNormalBuffer();
33 });
34
35 it('should set the normal buffer as the currently active buffer', () => {
36 assert.equal(bufferSet.active, bufferSet.normal);
37 });
38 });
39
40 describe('activateAltBuffer', () => {
41 beforeEach(() => {
42 bufferSet.activateAltBuffer();
43 });
44
45 it('should set the alt buffer as the currently active buffer', () => {
46 assert.equal(bufferSet.active, bufferSet.alt);
47 });
48 });
49 });