]> git.proxmox.com Git - mirror_xterm.js.git/blame - src/BufferSet.test.ts
Merge pull request #843 from Tyriar/842_resize_buffers_bug
[mirror_xterm.js.git] / src / BufferSet.test.ts
CommitLineData
cb5a452c
PK
1/**
2 * @license MIT
3 */
4import { assert } from 'chai';
5import { ITerminal } from './Interfaces';
6import { BufferSet } from './BufferSet';
7import { Buffer } from './Buffer';
f03d00a4 8import { MockTerminal } from './utils/TestUtils';
cb5a452c
PK
9
10describe('BufferSet', () => {
11 let terminal: ITerminal;
12 let bufferSet: BufferSet;
13
14 beforeEach(() => {
f03d00a4
DI
15 terminal = new MockTerminal();
16 terminal.cols = 80;
17 terminal.rows = 24;
18 terminal.scrollback = 1000;
cb5a452c
PK
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});