Remove ITerminal dependency in SelectionManager

This commit is contained in:
Daniel Imms
2019-06-23 14:29:59 -07:00
parent 4ecd0d2053
commit 88308f058c
3 changed files with 14 additions and 24 deletions
+4 -17
View File
@@ -6,27 +6,20 @@
import { assert } from 'chai';
import { SelectionManager, SelectionMode } from './SelectionManager';
import { SelectionModel } from 'browser/selection/SelectionModel';
import { ITerminal } from './Types';
import { IBuffer } from 'common/buffer/Types';
import { IBufferLine } from 'common/Types';
import { MockTerminal } from './TestUtils.test';
import { MockBufferService, MockOptionsService, MockCoreService } from 'common/TestUtils.test';
import { BufferLine } from 'common/buffer/BufferLine';
import { IBufferService, IOptionsService } from 'common/services/Services';
import { MockCharSizeService, MockMouseService } from 'browser/TestUtils.test';
import { CellData } from 'common/buffer/CellData';
class TestMockTerminal extends MockTerminal {
emit(event: string, data: any): void {}
}
import { IBuffer } from 'common/buffer/Types';
class TestSelectionManager extends SelectionManager {
constructor(
terminal: ITerminal,
bufferService: IBufferService,
optionsService: IOptionsService
) {
super(terminal, null, new MockCharSizeService(10, 10), bufferService, new MockCoreService(), new MockMouseService(), optionsService);
super(() => {}, null, null, new MockCharSizeService(10, 10), bufferService, new MockCoreService(), new MockMouseService(), optionsService);
}
public get model(): SelectionModel { return this._model; }
@@ -44,22 +37,16 @@ class TestSelectionManager extends SelectionManager {
}
describe('SelectionManager', () => {
let terminal: ITerminal;
let buffer: IBuffer;
let bufferService: IBufferService;
let optionsService: IOptionsService;
let selectionManager: TestSelectionManager;
beforeEach(() => {
terminal = new TestMockTerminal();
optionsService = new MockOptionsService();
bufferService = new MockBufferService(20, 20, optionsService);
terminal.buffers = bufferService.buffers;
terminal.cols = 20;
terminal.rows = 20;
terminal.buffer = terminal.buffers.active;
buffer = terminal.buffer;
selectionManager = new TestSelectionManager(terminal, bufferService, optionsService);
buffer = bufferService.buffer;
selectionManager = new TestSelectionManager(bufferService, optionsService);
});
function stringToRow(text: string): IBufferLine {