import { assert } from 'chai';
import { ITerminal } from './Interfaces';
import { SelectionModel } from './SelectionModel';
+import {BufferSet} from './BufferSet';
+import { MockTerminal } from './utils/TestUtils';
class TestSelectionModel extends SelectionModel {
constructor(
) {
super(terminal);
}
-
- public areSelectionValuesReversed(): boolean { return this._areSelectionValuesReversed(); }
}
describe('SelectionManager', () => {
let model: TestSelectionModel;
beforeEach(() => {
- terminal = <any>{ cols: 80, rows: 2, ybase: 0 };
+ terminal = new MockTerminal();
+ terminal.cols = 80;
+ terminal.rows = 2;
+ terminal.scrollback = 10;
+ terminal.buffers = new BufferSet(terminal);
+ terminal.buffer = terminal.buffers.active;
+
model = new TestSelectionModel(terminal);
});
});
});
- describe('_areSelectionValuesReversed', () => {
+ describe('areSelectionValuesReversed', () => {
it('should return true when the selection end is before selection start', () => {
model.selectionStart = [1, 0];
model.selectionEnd = [0, 0];
describe('finalSelectionEnd', () => {
it('should return the end of the buffer if select all is active', () => {
model.isSelectAllActive = true;
- assert.deepEqual(model.finalSelectionEnd, [79, 1]);
+ assert.deepEqual(model.finalSelectionEnd, [80, 1]);
});
it('should return null if there is no selection start', () => {
assert.equal(model.finalSelectionEnd, null);
model.selectionEnd = [1, 2];
assert.equal(model.finalSelectionEnd, null);
});
- it('should return null if there is no selection end or selection start length', () => {
- model.selectionStart = [1, 2];
- assert.equal(model.finalSelectionEnd, null);
- });
it('should return selection start + length if there is no selection end', () => {
model.selectionStart = [2, 2];
model.selectionStartLength = 2;