Skip to content

Commit 9545edf

Browse files
authored
TestInstantiationService in fileDialogService.test.ts (microsoft#165270)
Part of microsoft#164297
1 parent d1624fc commit 9545edf

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/vs/workbench/services/dialogs/browser/abstractFileDialogService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
1212
import { URI } from 'vs/base/common/uri';
1313
import * as resources from 'vs/base/common/resources';
1414
import { IInstantiationService, } from 'vs/platform/instantiation/common/instantiation';
15-
import { SimpleFileDialog } from 'vs/workbench/services/dialogs/browser/simpleFileDialog';
15+
import { ISimpleFileDialog, SimpleFileDialog } from 'vs/workbench/services/dialogs/browser/simpleFileDialog';
1616
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
1717
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
1818
import { IFileService } from 'vs/platform/files/common/files';
@@ -262,7 +262,7 @@ export abstract class AbstractFileDialogService implements IFileDialogService {
262262
return uri ? [uri] : undefined;
263263
}
264264

265-
protected getSimpleFileDialog(): SimpleFileDialog {
265+
protected getSimpleFileDialog(): ISimpleFileDialog {
266266
return this.instantiationService.createInstance(SimpleFileDialog);
267267
}
268268

src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ enum UpdateResult {
100100

101101
export const RemoteFileDialogContext = new RawContextKey<boolean>('remoteFileDialogVisible', false);
102102

103-
export class SimpleFileDialog {
103+
export interface ISimpleFileDialog {
104+
showOpenDialog(options: IOpenDialogOptions): Promise<URI | undefined>;
105+
showSaveDialog(options: ISaveDialogOptions): Promise<URI | undefined>;
106+
}
107+
108+
export class SimpleFileDialog implements ISimpleFileDialog {
104109
private options!: IOpenDialogOptions;
105110
private currentFolder!: URI;
106111
private filePickBox!: IQuickPick<FileQuickPickItem>;

src/vs/workbench/services/dialogs/test/electron-sandbox/fileDialogService.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace
2828
import { IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
2929
import { IHistoryService } from 'vs/workbench/services/history/common/history';
3030
import { IHostService } from 'vs/workbench/services/host/browser/host';
31-
import { SimpleFileDialog } from 'vs/workbench/services/dialogs/browser/simpleFileDialog';
31+
import { ISimpleFileDialog } from 'vs/workbench/services/dialogs/browser/simpleFileDialog';
3232
import { ICommandService } from 'vs/platform/commands/common/commands';
3333
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
3434
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
@@ -37,7 +37,7 @@ import { ILogService } from 'vs/platform/log/common/log';
3737

3838
class TestFileDialogService extends FileDialogService {
3939
constructor(
40-
private simple: SimpleFileDialog,
40+
private simple: ISimpleFileDialog,
4141
@IHostService hostService: IHostService,
4242
@IWorkspaceContextService contextService: IWorkspaceContextService,
4343
@IHistoryService historyService: IHistoryService,
@@ -90,7 +90,7 @@ suite('FileDialogService', function () {
9090
});
9191

9292
test('Local - open/save workspaces availableFilesystems', async function () {
93-
class TestSimpleFileDialog {
93+
class TestSimpleFileDialog implements ISimpleFileDialog {
9494
async showOpenDialog(options: IOpenDialogOptions): Promise<URI | undefined> {
9595
assert.strictEqual(options.availableFileSystems?.length, 1);
9696
assert.strictEqual(options.availableFileSystems[0], Schemas.file);
@@ -136,7 +136,7 @@ suite('FileDialogService', function () {
136136
});
137137

138138
test('Remote - open/save workspaces availableFilesystems', async function () {
139-
class TestSimpleFileDialog {
139+
class TestSimpleFileDialog implements ISimpleFileDialog {
140140
async showOpenDialog(options: IOpenDialogOptions): Promise<URI | undefined> {
141141
assert.strictEqual(options.availableFileSystems?.length, 2);
142142
assert.strictEqual(options.availableFileSystems[0], Schemas.vscodeRemote);

0 commit comments

Comments
 (0)