<commit_before>/**
 * Copyright (c) 2017 The xterm.js authors. All rights reserved.
 * @license MIT
 */

import jsdom = require('jsdom');
import { assert } from 'chai';
import { CharMeasure } from './utils/CharMeasure';
import { SelectionManager } from './SelectionManager';
import { SelectionModel } from './SelectionModel';
import { BufferSet } from './BufferSet';
import { LineData, CharData, ITerminal, IBuffer } from './Types';
import { MockTerminal } from './utils/TestUtils.test';

class TestMockTerminal extends MockTerminal {
  emit(event: string, data: any): void {}
}

class TestSelectionManager extends SelectionManager {
  constructor(
    terminal: ITerminal,
    charMeasure: CharMeasure
  ) {
    super(terminal, 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, true); }

  // Disable DOM interaction
  public enable(): void {}
  public disable(): void {}
  public refresh(): void {}
}

describe('SelectionManager', () => {
  let dom: jsdom.JSDOM;
  let window: Window;

  let terminal: ITerminal;
  let buffer: IBuffer;
  let selectionManager: TestSelectionManager;

  beforeEach(() => {
    dom = new jsdom.JSDOM('');
    window = dom.window;
    document = window.document;
    terminal = new TestMockTerminal();<commit_msg>Fix test<commit_after>/**
 * Copyright (c) 2017 The xterm.js authors. All rights reserved.
 * @license MIT
 */

import { assert } from 'chai';
import { CharMeasure } from './utils/CharMeasure';
import { SelectionManager } from './SelectionManager';
import { SelectionModel } from './SelectionModel';
import { BufferSet } from './BufferSet';
import { LineData, CharData, ITerminal, IBuffer } from './Types';
import { MockTerminal } from './utils/TestUtils.test';

class TestMockTerminal extends MockTerminal {
  emit(event: string, data: any): void {}
}

class TestSelectionManager extends SelectionManager {
  constructor(
    terminal: ITerminal,
    charMeasure: CharMeasure
  ) {
    super(terminal, 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, true); }

  // Disable DOM interaction
  public enable(): void {}
  public disable(): void {}
  public refresh(): void {}
}

describe('SelectionManager', () => {
  let terminal: ITerminal;
  let buffer: IBuffer;
  let selectionManager: TestSelectionManager;

  beforeEach(() => {
    terminal = new TestMockTerminal();
{'fraction_non_alphanumeric': 0.13174544101228136, 'fraction_numerical': 0.00297729810197246, 'mean_word_length': 4.365269461077844, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5804336', 'n_tokens_mistral': 783, 'n_tokens_neox': 759, 'n_words': 230}