@@ -12,11 +12,12 @@ import { Attributes, BgFlags, UnderlineStyle } from 'common/buffer/Constants';
12
12
import { AttributeData , ExtendedAttrs } from 'common/buffer/AttributeData' ;
13
13
import { Params } from 'common/parser/Params' ;
14
14
import { MockCoreService , MockBufferService , MockOptionsService , MockLogService , MockCoreMouseService , MockCharsetService , MockUnicodeService , MockOscLinkService } from 'common/TestUtils.test' ;
15
- import { IBufferService , ICoreService } from 'common/services/Services' ;
15
+ import { IBufferService , ICoreService , type IOscLinkService } from 'common/services/Services' ;
16
16
import { DEFAULT_OPTIONS } from 'common/services/OptionsService' ;
17
17
import { clone } from 'common/Clone' ;
18
18
import { BufferService } from 'common/services/BufferService' ;
19
19
import { CoreService } from 'common/services/CoreService' ;
20
+ import { OscLinkService } from 'common/services/OscLinkService' ;
20
21
21
22
22
23
function getCursor ( bufferService : IBufferService ) : number [ ] {
@@ -59,15 +60,17 @@ describe('InputHandler', () => {
59
60
let bufferService : IBufferService ;
60
61
let coreService : ICoreService ;
61
62
let optionsService : MockOptionsService ;
63
+ let oscLinkService : IOscLinkService ;
62
64
let inputHandler : TestInputHandler ;
63
65
64
66
beforeEach ( ( ) => {
65
67
optionsService = new MockOptionsService ( ) ;
66
68
bufferService = new BufferService ( optionsService ) ;
67
69
bufferService . resize ( 80 , 30 ) ;
68
70
coreService = new CoreService ( bufferService , new MockLogService ( ) , optionsService ) ;
71
+ oscLinkService = new OscLinkService ( bufferService ) ;
69
72
70
- inputHandler = new TestInputHandler ( bufferService , new MockCharsetService ( ) , coreService , new MockLogService ( ) , optionsService , new MockOscLinkService ( ) , new MockCoreMouseService ( ) , new MockUnicodeService ( ) ) ;
73
+ inputHandler = new TestInputHandler ( bufferService , new MockCharsetService ( ) , coreService , new MockLogService ( ) , optionsService , oscLinkService , new MockCoreMouseService ( ) , new MockUnicodeService ( ) ) ;
71
74
} ) ;
72
75
73
76
describe ( 'SL/SR/DECIC/DECDC' , ( ) => {
@@ -1982,6 +1985,32 @@ describe('InputHandler', () => {
1982
1985
assert . deepEqual ( stack , [ [ { type : ColorRequestType . SET , index : 0 , color : [ 170 , 187 , 204 ] } , { type : ColorRequestType . SET , index : 123 , color : [ 0 , 17 , 34 ] } ] ] ) ;
1983
1986
stack . length = 0 ;
1984
1987
} ) ;
1988
+ it ( '8: hyperlink with id' , async ( ) => {
1989
+ await inputHandler . parseP ( '\x1b]8;id=100;http://localhost:3000\x07' ) ;
1990
+ assert . notStrictEqual ( inputHandler . curAttrData . extended . urlId , 0 ) ;
1991
+ assert . deepStrictEqual (
1992
+ oscLinkService . getLinkData ( inputHandler . curAttrData . extended . urlId ) ,
1993
+ {
1994
+ id : '100' ,
1995
+ uri : 'http://localhost:3000'
1996
+ }
1997
+ ) ;
1998
+ await inputHandler . parseP ( '\x1b]8;;\x07' ) ;
1999
+ assert . strictEqual ( inputHandler . curAttrData . extended . urlId , 0 ) ;
2000
+ } ) ;
2001
+ it ( '8: hyperlink with semi-colon' , async ( ) => {
2002
+ await inputHandler . parseP ( '\x1b]8;;http://localhost:3000;abc=def\x07' ) ;
2003
+ assert . notStrictEqual ( inputHandler . curAttrData . extended . urlId , 0 ) ;
2004
+ assert . deepStrictEqual (
2005
+ oscLinkService . getLinkData ( inputHandler . curAttrData . extended . urlId ) ,
2006
+ {
2007
+ id : undefined ,
2008
+ uri : 'http://localhost:3000;abc=def'
2009
+ }
2010
+ ) ;
2011
+ await inputHandler . parseP ( '\x1b]8;;\x07' ) ;
2012
+ assert . strictEqual ( inputHandler . curAttrData . extended . urlId , 0 ) ;
2013
+ } ) ;
1985
2014
it ( '104: restore events' , async ( ) => {
1986
2015
const stack : IColorEvent [ ] = [ ] ;
1987
2016
inputHandler . onColor ( ev => stack . push ( ev ) ) ;
0 commit comments