33 * @license MIT
44 */
55import { CoreMouseService } from 'common/services/CoreMouseService' ;
6- import { MockCoreService , MockBufferService } from 'common/TestUtils.test' ;
6+ import { MockCoreService , MockBufferService , MockOptionsService } from 'common/TestUtils.test' ;
77import { assert } from 'chai' ;
88import { ICoreMouseEvent , CoreMouseEventType , CoreMouseButton , CoreMouseAction } from 'common/Types' ;
99
1010// needed mock services
1111const bufferService = new MockBufferService ( 300 , 100 ) ;
1212const coreService = new MockCoreService ( ) ;
13+ const optionsService = new MockOptionsService ( ) ;
1314
1415function toBytes ( s : string | undefined ) : number [ ] {
1516 if ( ! s ) {
@@ -24,20 +25,20 @@ function toBytes(s: string | undefined): number[] {
2425
2526describe ( 'CoreMouseService' , ( ) => {
2627 it ( 'init' , ( ) => {
27- const cms = new CoreMouseService ( bufferService , coreService ) ;
28+ const cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
2829 assert . equal ( cms . activeEncoding , 'DEFAULT' ) ;
2930 assert . equal ( cms . activeProtocol , 'NONE' ) ;
3031 } ) ;
3132 it ( 'default protocols - NONE, X10, VT200, DRAG, ANY' , ( ) => {
32- const cms = new CoreMouseService ( bufferService , coreService ) ;
33+ const cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
3334 assert . deepEqual ( Object . keys ( ( cms as any ) . _protocols ) , [ 'NONE' , 'X10' , 'VT200' , 'DRAG' , 'ANY' ] ) ;
3435 } ) ;
3536 it ( 'default encodings - DEFAULT, SGR' , ( ) => {
36- const cms = new CoreMouseService ( bufferService , coreService ) ;
37+ const cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
3738 assert . deepEqual ( Object . keys ( ( cms as any ) . _encodings ) , [ 'DEFAULT' , 'SGR' , 'SGR_PIXELS' ] ) ;
3839 } ) ;
3940 it ( 'protocol/encoding setter, reset' , ( ) => {
40- const cms = new CoreMouseService ( bufferService , coreService ) ;
41+ const cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
4142 cms . activeEncoding = 'SGR' ;
4243 cms . activeProtocol = 'ANY' ;
4344 assert . equal ( cms . activeEncoding , 'SGR' ) ;
@@ -49,19 +50,19 @@ describe('CoreMouseService', () => {
4950 assert . throws ( ( ) => { cms . activeProtocol = 'xyz' ; } , 'unknown protocol "xyz"' ) ;
5051 } ) ;
5152 it ( 'addEncoding' , ( ) => {
52- const cms = new CoreMouseService ( bufferService , coreService ) ;
53+ const cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
5354 cms . addEncoding ( 'XYZ' , ( e : ICoreMouseEvent ) => '' ) ;
5455 cms . activeEncoding = 'XYZ' ;
5556 assert . equal ( cms . activeEncoding , 'XYZ' ) ;
5657 } ) ;
5758 it ( 'addProtocol' , ( ) => {
58- const cms = new CoreMouseService ( bufferService , coreService ) ;
59+ const cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
5960 cms . addProtocol ( 'XYZ' , { events : CoreMouseEventType . NONE , restrict : ( e : ICoreMouseEvent ) => false } ) ;
6061 cms . activeProtocol = 'XYZ' ;
6162 assert . equal ( cms . activeProtocol , 'XYZ' ) ;
6263 } ) ;
6364 it ( 'onProtocolChange' , ( ) => {
64- const cms = new CoreMouseService ( bufferService , coreService ) ;
65+ const cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
6566 const wantedEvents : CoreMouseEventType [ ] = [ ] ;
6667 cms . onProtocolChange ( events => wantedEvents . push ( events ) ) ;
6768 cms . activeProtocol = 'NONE' ;
@@ -76,7 +77,7 @@ describe('CoreMouseService', () => {
7677 let cms : CoreMouseService ;
7778 let reports : string [ ] ;
7879 beforeEach ( ( ) => {
79- cms = new CoreMouseService ( bufferService , coreService ) ;
80+ cms = new CoreMouseService ( bufferService , coreService , optionsService ) ;
8081 reports = [ ] ;
8182 coreService . triggerDataEvent = ( data : string , userInput ?: boolean ) => reports . push ( data ) ;
8283 coreService . triggerBinaryEvent = ( data : string ) => reports . push ( data ) ;
0 commit comments