mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Fix Linkifier2 tests
This commit is contained in:
@@ -10,18 +10,14 @@ import { MockBufferService } from 'common/TestUtils.test';
|
||||
import { ILink } from 'browser/Types';
|
||||
|
||||
class TestLinkifier2 extends Linkifier2 {
|
||||
protected _currentLinkState = {
|
||||
decorations: {
|
||||
underline: true,
|
||||
pointerCursor: true
|
||||
},
|
||||
isHovered: true
|
||||
};
|
||||
|
||||
constructor(bufferService: IBufferService) {
|
||||
super(bufferService);
|
||||
}
|
||||
|
||||
public set currentLink(link: any) {
|
||||
this._currentLink = link;
|
||||
}
|
||||
|
||||
public linkHover(element: HTMLElement, link: ILink, event: MouseEvent): void {
|
||||
this._linkHover(element, link, event);
|
||||
}
|
||||
@@ -35,11 +31,6 @@ describe('Linkifier2', () => {
|
||||
let bufferService: IBufferService;
|
||||
let linkifier: TestLinkifier2;
|
||||
|
||||
beforeEach(() => {
|
||||
bufferService = new MockBufferService(100, 10);
|
||||
linkifier = new TestLinkifier2(bufferService);
|
||||
});
|
||||
|
||||
const link: ILink = {
|
||||
text: 'foo',
|
||||
range: {
|
||||
@@ -55,6 +46,21 @@ describe('Linkifier2', () => {
|
||||
activate: () => { }
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
bufferService = new MockBufferService(100, 10);
|
||||
linkifier = new TestLinkifier2(bufferService);
|
||||
linkifier.currentLink = {
|
||||
link,
|
||||
state: {
|
||||
decorations: {
|
||||
underline: true,
|
||||
pointerCursor: true
|
||||
},
|
||||
isHovered: true
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
it('onShowLinkUnderline event range is correct', done => {
|
||||
linkifier.onShowLinkUnderline(e => {
|
||||
assert.equal(link.range.start.x - 1, e.x1);
|
||||
|
||||
@@ -26,7 +26,7 @@ export class Linkifier2 extends Disposable implements ILinkifier2 {
|
||||
private _mouseService: IMouseService | undefined;
|
||||
private _renderService: IRenderService | undefined;
|
||||
private _linkProviders: ILinkProvider[] = [];
|
||||
private _currentLink: ILinkWithState | undefined;
|
||||
protected _currentLink: ILinkWithState | undefined;
|
||||
private _lastMouseEvent: MouseEvent | undefined;
|
||||
private _linkCacheDisposables: IDisposable[] = [];
|
||||
private _lastBufferCell: IBufferCellPosition | undefined;
|
||||
|
||||
Reference in New Issue
Block a user