Get rid of exposed test method (phantom is gone)

This commit is contained in:
Daniel Imms
2017-02-27 12:56:54 -08:00
parent f6dafee748
commit 15d79143e2
2 changed files with 14 additions and 16 deletions
+6 -1
View 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;
+8 -15
View 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;
}
}