import { CharMeasure } from './utils/CharMeasure';
import { CircularList } from './utils/CircularList';
import { SelectionManager } from './SelectionManager';
+import { SelectionModel } from "./SelectionModel";
class TestSelectionManager extends SelectionManager {
constructor(
super(terminal, buffer, rowContainer, charMeasure);
}
+ public get model(): SelectionModel { return this._model; }
+
+ public selectLineAt(line: number): void { this._selectLineAt(line); }
public selectWordAt(coords: [number, number]): void { this._selectWordAt(coords); }
// Disable DOM interaction
let window: Window;
let document: Document;
+ let terminal: ITerminal;
let buffer: CircularList<any>;
let rowContainer: HTMLElement;
let selectionManager: TestSelectionManager;
window = w;
document = window.document;
buffer = new CircularList<any>(100);
- selectionManager = new TestSelectionManager(null, buffer, rowContainer, null);
+ terminal = <any>{ cols: 80 };
+ selectionManager = new TestSelectionManager(terminal, buffer, rowContainer, null);
done();
});
});
assert.equal(selectionManager.selectionText, 'foo');
});
});
+
+ describe('_selectLineAt', () => {
+ it('should select the entire line', () => {
+ buffer.push(stringToRow('foo bar'));
+ selectionManager.selectLineAt(0);
+ assert.equal(selectionManager.selectionText, 'foo bar', 'The selected text is correct');
+ assert.deepEqual(selectionManager.model.finalSelectionStart, [0, 0]);
+ assert.deepEqual(selectionManager.model.finalSelectionEnd, [terminal.cols, 0], 'The actual selection spans the entire column');
+ });
+ });
});