]> git.proxmox.com Git - mirror_xterm.js.git/blobdiff - src/SelectionModel.test.ts
Merge pull request #926 from ficristo/search-fix
[mirror_xterm.js.git] / src / SelectionModel.test.ts
index e8629596c0fc6e4c1b4f4c6480688e5ec654e5ad..b087944273a54da097fcbc9cc6f01c01245a2687 100644 (file)
@@ -4,6 +4,8 @@
 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(
@@ -11,8 +13,6 @@ class TestSelectionModel extends SelectionModel {
   ) {
     super(terminal);
   }
-
-  public areSelectionValuesReversed(): boolean { return this._areSelectionValuesReversed(); }
 }
 
 describe('SelectionManager', () => {
@@ -23,7 +23,13 @@ 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);
   });
 
@@ -39,7 +45,7 @@ describe('SelectionManager', () => {
     });
   });
 
-  describe('_areSelectionValuesReversed', () => {
+  describe('areSelectionValuesReversed', () => {
     it('should return true when the selection end is before selection start', () => {
       model.selectionStart = [1, 0];
       model.selectionEnd = [0, 0];