]> git.proxmox.com Git - mirror_xterm.js.git/commitdiff
Get rid of exposed test method (phantom is gone)
authorDaniel Imms <daimms@microsoft.com>
Mon, 27 Feb 2017 20:56:54 +0000 (12:56 -0800)
committerDaniel Imms <daimms@microsoft.com>
Mon, 27 Feb 2017 20:56:54 +0000 (12:56 -0800)
src/Linkifier.test.ts
src/Linkifier.ts

index bdab5cb2480aa8d4bc532f19a9f59ef1c163a8d0..b1c1541df1ad7d7a5e08ce31ca2ad00a411c69da 100644 (file)
@@ -6,7 +6,12 @@ import { assert } from 'chai';
 import { ITerminal, ILinkifier } from './Interfaces';
 import { Linkifier } from './Linkifier';
 
-Linkifier.setTimeBeforeLinkifyForTest(0);
+class TestLinkifier extends Linkifier {
+  constructor(document: Document, rows: HTMLElement[]) {
+    Linkifier.TIME_BEFORE_LINKIFY = 0;
+    super(document, rows);
+  }
+}
 
 describe('Linkifier', () => {
   let window: Window;
index f15cfe654c0d2ec449b91dd0d13d990e6cf24c48..f8b8ca895f0d8329b6ce27a09634ec7f41d74919 100644 (file)
@@ -36,17 +36,17 @@ const strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end);
  */
 const HYPERTEXT_LINK_MATCHER_ID = 0;
 
-/**
- * The time to wait after a row is changed before it is linkified. This prevents
- * the costly operation of searching every row multiple times, pntentially a
- * huge aount of times.
- */
-let TIME_BEFORE_LINKIFY = 200;
-
 /**
  * The Linkifier applies links to rows shortly after they have been refreshed.
  */
 export class Linkifier {
+  /**
+   * The time to wait after a row is changed before it is linkified. This prevents
+   * the costly operation of searching every row multiple times, pntentially a
+   * huge aount of times.
+   */
+  protected static TIME_BEFORE_LINKIFY = 200;
+
   private _document: Document;
   private _rows: HTMLElement[];
   private _rowTimeoutIds: number[];
@@ -70,7 +70,7 @@ export class Linkifier {
     if (timeoutId) {
       clearTimeout(timeoutId);
     }
-    this._rowTimeoutIds[rowIndex] = setTimeout(this._linkifyRow.bind(this, rowIndex), TIME_BEFORE_LINKIFY);
+    this._rowTimeoutIds[rowIndex] = setTimeout(this._linkifyRow.bind(this, rowIndex), Linkifier.TIME_BEFORE_LINKIFY);
   }
 
   /**
@@ -284,11 +284,4 @@ export class Linkifier {
       this._replaceNode(node, leftTextNode, newNode, rightTextNode);
     }
   }
-
-  public static setTimeBeforeLinkifyForTest(time: number) {
-    // This is necessary since it's needs to be used in PhantomJS. Ideally the
-    // time variable would be a protected static member and a TestLinkifier
-    // would expose it for the test.
-    TIME_BEFORE_LINKIFY = time;
-  }
 }