@@ -1064,6 +1064,56 @@ describe('XTerminalElement', () => {
1064
1064
expect ( this . element . ptyProcess ) . toBeTruthy ( )
1065
1065
} )
1066
1066
1067
+ describe ( 'loaded addons' , ( ) => {
1068
+ const { Terminal } = require ( 'xterm' )
1069
+ const { WebLinksAddon } = require ( 'xterm-addon-web-links' )
1070
+ const { WebglAddon } = require ( 'xterm-addon-webgl' )
1071
+
1072
+ beforeEach ( ( ) => {
1073
+ spyOn ( Terminal . prototype , 'loadAddon' ) . and . callThrough ( )
1074
+ } )
1075
+
1076
+ it ( 'createTerminal() enable web-link addon' , async ( ) => {
1077
+ const params = new URLSearchParams ( { webLinks : true } )
1078
+ const url = new URL ( 'x-terminal://?' + params . toString ( ) )
1079
+ await createNewElement ( url . href )
1080
+ const wasAdded = Terminal . prototype . loadAddon . calls . all ( ) . some ( call => {
1081
+ return call . args [ 0 ] instanceof WebLinksAddon
1082
+ } )
1083
+ expect ( wasAdded ) . toBe ( true )
1084
+ } )
1085
+
1086
+ it ( 'createTerminal() disable web-link addon' , async ( ) => {
1087
+ const params = new URLSearchParams ( { webLinks : false } )
1088
+ const url = new URL ( 'x-terminal://?' + params . toString ( ) )
1089
+ await createNewElement ( url . href )
1090
+ const wasAdded = Terminal . prototype . loadAddon . calls . all ( ) . some ( call => {
1091
+ return call . args [ 0 ] instanceof WebLinksAddon
1092
+ } )
1093
+ expect ( wasAdded ) . toBe ( false )
1094
+ } )
1095
+
1096
+ it ( 'createTerminal() enable webgl addon' , async ( ) => {
1097
+ const params = new URLSearchParams ( { webgl : true } )
1098
+ const url = new URL ( 'x-terminal://?' + params . toString ( ) )
1099
+ await createNewElement ( url . href )
1100
+ const wasAdded = Terminal . prototype . loadAddon . calls . all ( ) . some ( call => {
1101
+ return call . args [ 0 ] instanceof WebglAddon
1102
+ } )
1103
+ expect ( wasAdded ) . toBe ( true )
1104
+ } )
1105
+
1106
+ it ( 'createTerminal() disable webgl addon' , async ( ) => {
1107
+ const params = new URLSearchParams ( { webgl : false } )
1108
+ const url = new URL ( 'x-terminal://?' + params . toString ( ) )
1109
+ await createNewElement ( url . href )
1110
+ const wasAdded = Terminal . prototype . loadAddon . calls . all ( ) . some ( call => {
1111
+ return call . args [ 0 ] instanceof WebglAddon
1112
+ } )
1113
+ expect ( wasAdded ) . toBe ( false )
1114
+ } )
1115
+ } )
1116
+
1067
1117
it ( 'restartPtyProcess() check new pty process created' , async ( ) => {
1068
1118
const oldPtyProcess = this . element . ptyProcess
1069
1119
const newPtyProcess = jasmine . createSpyObj ( 'ptyProcess' ,
0 commit comments