@@ -12,9 +12,6 @@ import { CommandService } from 'vs/platform/commands/common/commandService';
1212import { IExtensionService , ExtensionPointContribution , IExtensionDescription , IExtensionHostInformation , ProfileSession } from 'vs/platform/extensions/common/extensions' ;
1313import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService' ;
1414import { IExtensionPoint } from 'vs/platform/extensions/common/extensionsRegistry' ;
15- import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService' ;
16- import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices' ;
17- import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey' ;
1815import Event , { Emitter } from 'vs/base/common/event' ;
1916import { NullLogService } from 'vs/platform/log/common/log' ;
2017
@@ -75,7 +72,7 @@ suite('CommandService', function () {
7572 lastEvent = activationEvent ;
7673 return super . activateByEvent ( activationEvent ) ;
7774 }
78- } , new ContextKeyService ( new SimpleConfigurationService ( ) ) , new NullLogService ( ) ) ;
75+ } , new NullLogService ( ) ) ;
7976
8077 return service . executeCommand ( 'foo' ) . then ( ( ) => {
8178 assert . ok ( lastEvent , 'onCommand:foo' ) ;
@@ -93,7 +90,7 @@ suite('CommandService', function () {
9390 activateByEvent ( activationEvent : string ) : TPromise < void > {
9491 return TPromise . wrapError < void > ( new Error ( 'bad_activate' ) ) ;
9592 }
96- } , new ContextKeyService ( new SimpleConfigurationService ( ) ) , new NullLogService ( ) ) ;
93+ } , new NullLogService ( ) ) ;
9794
9895 return service . executeCommand ( 'foo' ) . then ( ( ) => assert . ok ( false ) , err => {
9996 assert . equal ( err . message , 'bad_activate' ) ;
@@ -109,7 +106,7 @@ suite('CommandService', function () {
109106 whenInstalledExtensionsRegistered ( ) {
110107 return new TPromise < boolean > ( _resolve => { /*ignore*/ } ) ;
111108 }
112- } , new ContextKeyService ( new SimpleConfigurationService ( ) ) , new NullLogService ( ) ) ;
109+ } , new NullLogService ( ) ) ;
113110
114111 service . executeCommand ( 'bar' ) ;
115112 assert . equal ( callCounter , 1 ) ;
@@ -126,7 +123,7 @@ suite('CommandService', function () {
126123 whenInstalledExtensionsRegistered ( ) {
127124 return new TPromise < boolean > ( _resolve => { resolveFunc = _resolve ; } ) ;
128125 }
129- } , new ContextKeyService ( new SimpleConfigurationService ( ) ) , new NullLogService ( ) ) ;
126+ } , new NullLogService ( ) ) ;
130127
131128 let r = service . executeCommand ( 'bar' ) ;
132129 assert . equal ( callCounter , 0 ) ;
@@ -139,32 +136,4 @@ suite('CommandService', function () {
139136 assert . equal ( callCounter , 1 ) ;
140137 } ) ;
141138 } ) ;
142-
143- test ( 'honor command-precondition' , function ( ) {
144- let contextKeyService = new ContextKeyService ( new SimpleConfigurationService ( ) ) ;
145- let commandService = new CommandService (
146- new InstantiationService ( ) ,
147- new SimpleExtensionService ( ) ,
148- contextKeyService ,
149- new NullLogService ( )
150- ) ;
151-
152- let counter = 0 ;
153- let reg = CommandsRegistry . registerCommand ( {
154- id : 'bar' ,
155- handler : ( ) => { counter += 1 ; } ,
156- precondition : ContextKeyExpr . has ( 'foocontext' )
157- } ) ;
158-
159- return commandService . executeCommand ( 'bar' ) . then ( ( ) => {
160- assert . throws ( ( ) => { } ) ;
161- } , ( ) => {
162- contextKeyService . setContext ( 'foocontext' , true ) ;
163- return commandService . executeCommand ( 'bar' ) ;
164- } ) . then ( ( ) => {
165- assert . equal ( counter , 1 ) ;
166- reg . dispose ( ) ;
167- } ) ;
168-
169- } ) ;
170139} ) ;
0 commit comments