]> git.proxmox.com Git - mirror_xterm.js.git/blob - src/BufferSet.test.ts
Merge pull request #926 from ficristo/search-fix
[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 import { MockTerminal } from './utils/TestUtils';
9
10 describe('BufferSet', () => {
11 let terminal: ITerminal;
12 let bufferSet: BufferSet;
13
14 beforeEach(() => {
15 terminal = new MockTerminal();
16 terminal.cols = 80;
17 terminal.rows = 24;
18 terminal.scrollback = 1000;
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 });