@@ -47,8 +47,6 @@ const invokeCompletionContext: CompletionContext = {
47
47
} ;
48
48
49
49
suite ( 'Tests for Expand Abbreviations (HTML)' , ( ) => {
50
- const oldValueForExcludeLanguages = workspace . getConfiguration ( 'emmet' ) . inspect ( 'excludeLanguages' ) ;
51
- const oldValueForIncludeLanguages = workspace . getConfiguration ( 'emmet' ) . inspect ( 'includeLanguages' ) ;
52
50
teardown ( closeAllEditors ) ;
53
51
54
52
test ( 'Expand snippets (HTML)' , ( ) => {
@@ -364,6 +362,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
364
362
} ) ;
365
363
366
364
test ( 'Expand html when inside script tag with javascript type if js is mapped to html (HTML)' , async ( ) => {
365
+ const oldConfig = workspace . getConfiguration ( 'emmet' ) . inspect ( 'includeLanguages' ) ?. globalValue ;
367
366
await workspace . getConfiguration ( 'emmet' ) . update ( 'includeLanguages' , { 'javascript' : 'html' } , ConfigurationTarget . Global ) ;
368
367
await withRandomFileEditor ( htmlContents , 'html' , async ( editor , _doc ) => {
369
368
editor . selection = new Selection ( 24 , 10 , 24 , 10 ) ;
@@ -374,12 +373,13 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
374
373
await expandPromise ;
375
374
assert . strictEqual ( editor . document . getText ( ) , htmlContents . replace ( 'span.bye' , '<span class="bye"></span>' ) ) ;
376
375
} ) ;
377
- return workspace . getConfiguration ( 'emmet' ) . update ( 'includeLanguages' , oldValueForIncludeLanguages || { } , ConfigurationTarget . Global ) ;
376
+ await workspace . getConfiguration ( 'emmet' ) . update ( 'includeLanguages' , oldConfig , ConfigurationTarget . Global ) ;
378
377
} ) ;
379
378
380
379
test ( 'Expand html in completion list when inside script tag with javascript type if js is mapped to html (HTML)' , async ( ) => {
381
380
const abbreviation = 'span.bye' ;
382
381
const expandedText = '<span class="bye"></span>' ;
382
+ const oldConfig = workspace . getConfiguration ( 'emmet' ) . inspect ( 'includeLanguages' ) ?. globalValue ;
383
383
await workspace . getConfiguration ( 'emmet' ) . update ( 'includeLanguages' , { 'javascript' : 'html' } , ConfigurationTarget . Global ) ;
384
384
await withRandomFileEditor ( htmlContents , 'html' , async ( editor , _doc ) => {
385
385
editor . selection = new Selection ( 24 , 10 , 24 , 10 ) ;
@@ -399,7 +399,7 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
399
399
assert . strictEqual ( ( ( < string > emmetCompletionItem . documentation ) || '' ) . replace ( / \| / g, '' ) , expandedText , `Docs of completion item doesnt match.` ) ;
400
400
return Promise . resolve ( ) ;
401
401
} ) ;
402
- return workspace . getConfiguration ( 'emmet' ) . update ( 'includeLanguages' , oldValueForIncludeLanguages || { } , ConfigurationTarget . Global ) ;
402
+ await workspace . getConfiguration ( 'emmet' ) . update ( 'includeLanguages' , oldConfig , ConfigurationTarget . Global ) ;
403
403
} ) ;
404
404
405
405
// test('No expanding when html is excluded in the settings', () => {
@@ -411,9 +411,10 @@ suite('Tests for Expand Abbreviations (HTML)', () => {
411
411
// });
412
412
413
413
test ( 'No expanding when html is excluded in the settings in completion list' , async ( ) => {
414
+ const oldConfig = workspace . getConfiguration ( 'emmet' ) . inspect ( 'excludeLanguages' ) ?. globalValue ;
414
415
await workspace . getConfiguration ( 'emmet' ) . update ( 'excludeLanguages' , [ 'html' ] , ConfigurationTarget . Global ) ;
415
416
await testHtmlCompletionProvider ( new Selection ( 9 , 6 , 9 , 6 ) , '' , '' , true ) ;
416
- return workspace . getConfiguration ( 'emmet' ) . update ( 'excludeLanguages' , oldValueForExcludeLanguages ? oldValueForExcludeLanguages . globalValue : undefined , ConfigurationTarget . Global ) ;
417
+ await workspace . getConfiguration ( 'emmet' ) . update ( 'excludeLanguages' , oldConfig , ConfigurationTarget . Global ) ;
417
418
} ) ;
418
419
419
420
// test('No expanding when php (mapped syntax) is excluded in the settings', () => {
0 commit comments