fix tests

This commit is contained in:
Sandeep Somavarapu 2021-02-09 14:36:52 +01:00
parent 478a76a1a6
commit acaf2ed2ac
2 changed files with 9 additions and 11 deletions

View file

@ -73,10 +73,9 @@ export class UserDataAutoSyncEnablementService extends Disposable implements _IU
}
setEnablement(enabled: boolean): void {
if (!this.canToggleEnablement()) {
throw new Error('Cannot toggle enablement');
if (this.canToggleEnablement()) {
this.storageService.store(enablementKey, enabled, StorageScope.GLOBAL, StorageTarget.MACHINE);
}
this.storageService.store(enablementKey, enabled, StorageScope.GLOBAL, StorageTarget.MACHINE);
}
private onDidStorageChange(storageChangeEvent: IStorageValueChangeEvent): void {

View file

@ -29,14 +29,13 @@ export class WebUserDataAutoSyncEnablementService extends UserDataAutoSyncEnable
}
setEnablement(enabled: boolean) {
if (!this.canToggleEnablement()) {
throw new Error('Cannot toggle enablement');
}
if (this.enabled !== enabled) {
this.enabled = enabled;
super.setEnablement(enabled);
if (this.workbenchEnvironmentService.options?.settingsSyncOptions?.enablementHandler) {
this.workbenchEnvironmentService.options.settingsSyncOptions.enablementHandler(this.enabled);
if (this.canToggleEnablement()) {
if (this.enabled !== enabled) {
this.enabled = enabled;
super.setEnablement(enabled);
if (this.workbenchEnvironmentService.options?.settingsSyncOptions?.enablementHandler) {
this.workbenchEnvironmentService.options.settingsSyncOptions.enablementHandler(this.enabled);
}
}
}
}