diff --git a/src/vs/workbench/test/browser/parts/editor/resourceEditorInput.ts b/src/vs/workbench/test/browser/parts/editor/resourceEditorInput.ts new file mode 100644 index 00000000000..e6f3a587d85 --- /dev/null +++ b/src/vs/workbench/test/browser/parts/editor/resourceEditorInput.ts @@ -0,0 +1,55 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + +import * as assert from 'assert'; +import { URI } from 'vs/base/common/uri'; +import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { workbenchInstantiationService } from 'vs/workbench/test/browser/workbenchTestServices'; +import { AbstractResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput'; +import { ILabelService } from 'vs/platform/label/common/label'; +import { IFileService } from 'vs/platform/files/common/files'; +import { Verbosity } from 'vs/workbench/common/editor'; + +suite('Resource editors', () => { + + let instantiationService: IInstantiationService; + + class TestResourceEditorInput extends AbstractResourceEditorInput { + + readonly typeId = 'test.typeId'; + + constructor( + resource: URI, + @ILabelService labelService: ILabelService, + @IFileService fileService: IFileService + ) { + super(resource, resource, labelService, fileService); + } + } + + setup(() => { + instantiationService = workbenchInstantiationService(); + }); + + test('basics', async () => { + const resource = URI.from({ scheme: 'testResource', path: 'thePath' }); + + const input = instantiationService.createInstance(TestResourceEditorInput, resource); + + assert.ok(input.getName().length > 0); + + assert.ok(input.getDescription(Verbosity.SHORT)!.length > 0); + assert.ok(input.getDescription(Verbosity.MEDIUM)!.length > 0); + assert.ok(input.getDescription(Verbosity.LONG)!.length > 0); + + assert.ok(input.getTitle(Verbosity.SHORT).length > 0); + assert.ok(input.getTitle(Verbosity.MEDIUM).length > 0); + assert.ok(input.getTitle(Verbosity.LONG).length > 0); + + assert.strictEqual(input.isReadonly(), false); + assert.strictEqual(input.isUntitled(), true); + assert.strictEqual(input.isOrphaned(), false); + }); +});