Get rid of exposed test method (phantom is gone)
This commit is contained in:
@@ -6,7 +6,12 @@ import { assert } from 'chai';
|
|||||||
import { ITerminal, ILinkifier } from './Interfaces';
|
import { ITerminal, ILinkifier } from './Interfaces';
|
||||||
import { Linkifier } from './Linkifier';
|
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', () => {
|
describe('Linkifier', () => {
|
||||||
let window: Window;
|
let window: Window;
|
||||||
|
|||||||
+8
-15
@@ -36,17 +36,17 @@ const strictUrlRegex = new RegExp(start + protocolClause + bodyClause + end);
|
|||||||
*/
|
*/
|
||||||
const HYPERTEXT_LINK_MATCHER_ID = 0;
|
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.
|
* The Linkifier applies links to rows shortly after they have been refreshed.
|
||||||
*/
|
*/
|
||||||
export class Linkifier {
|
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 _document: Document;
|
||||||
private _rows: HTMLElement[];
|
private _rows: HTMLElement[];
|
||||||
private _rowTimeoutIds: number[];
|
private _rowTimeoutIds: number[];
|
||||||
@@ -70,7 +70,7 @@ export class Linkifier {
|
|||||||
if (timeoutId) {
|
if (timeoutId) {
|
||||||
clearTimeout(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);
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user