提交 5f491b47 编写于 作者: S Sandeep Somavarapu

Fix #53050

上级 4318f34e
......@@ -204,6 +204,11 @@ export class UninstallAction extends Action {
return;
}
if (state !== ExtensionState.Installed) {
this.enabled = false;
return;
}
if (installedExtensions[0].type !== LocalExtensionType.User) {
this.enabled = false;
return;
......@@ -254,23 +259,23 @@ export class CombinedInstallAction extends Action {
if (!this.extension || this.extension.type === LocalExtensionType.System) {
this.enabled = false;
this.class = CombinedInstallAction.NoExtensionClass;
} else if (this.installAction.enabled) {
this.enabled = true;
} else if (this.extension.state === ExtensionState.Installing) {
this.enabled = false;
this.label = this.installAction.label;
this.class = this.installAction.class;
this.tooltip = this.installAction.tooltip;
} else if (this.uninstallAction.enabled) {
this.enabled = true;
} else if (this.extension.state === ExtensionState.Uninstalling) {
this.enabled = false;
this.label = this.uninstallAction.label;
this.class = this.uninstallAction.class;
this.tooltip = this.uninstallAction.tooltip;
} else if (this.extension.state === ExtensionState.Installing) {
this.enabled = false;
} else if (this.installAction.enabled) {
this.enabled = true;
this.label = this.installAction.label;
this.class = this.installAction.class;
this.tooltip = this.installAction.tooltip;
} else if (this.extension.state === ExtensionState.Uninstalling) {
this.enabled = false;
} else if (this.uninstallAction.enabled) {
this.enabled = true;
this.label = this.uninstallAction.label;
this.class = this.uninstallAction.class;
this.tooltip = this.uninstallAction.tooltip;
......
......@@ -223,6 +223,20 @@ suite('ExtensionsActions Test', () => {
});
});
test('Test Uninstall action when state is installing and is user extension', () => {
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
const local = aLocalExtension('a');
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
return instantiationService.get(IExtensionsWorkbenchService).queryLocal()
.then(extensions => {
const gallery = aGalleryExtension('a');
installEvent.fire({ identifier: gallery.identifier, gallery });
testObject.extension = extensions[0];
assert.ok(!testObject.enabled);
});
});
test('Test Uninstall action after extension is installed', () => {
const testObject: ExtensionsActions.UninstallAction = instantiationService.createInstance(ExtensionsActions.UninstallAction);
const gallery = aGalleryExtension('a');
......@@ -306,6 +320,22 @@ suite('ExtensionsActions Test', () => {
});
});
test('Test CombinedInstallAction when state is installing during update', () => {
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
const local = aLocalExtension('a');
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', [local]);
return instantiationService.get(IExtensionsWorkbenchService).queryLocal()
.then(extensions => {
testObject.extension = extensions[0];
const gallery = aGalleryExtension('a');
installEvent.fire({ identifier: gallery.identifier, gallery });
assert.ok(!testObject.enabled);
assert.equal('Installing', testObject.label);
assert.equal('extension-action install installing', testObject.class);
});
});
test('Test CombinedInstallAction when state is uninstalling', () => {
const testObject: ExtensionsActions.CombinedInstallAction = instantiationService.createInstance(ExtensionsActions.CombinedInstallAction);
const local = aLocalExtension('a');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册