mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 18:46:36 -05:00
Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 (#8722)
* Merge from vscode 4636be2b71c87bfb0bfe3c94278b447a5efcc1f1 * remove tests that aren't working
This commit is contained in:
@@ -6,19 +6,19 @@
|
||||
import * as assert from 'assert';
|
||||
import { BaseEditor, EditorMemento } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { EditorInput, EditorOptions, IEditorInputFactory, IEditorInputFactoryRegistry, Extensions as EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as Platform from 'vs/platform/registry/common/platform';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { NullTelemetryService } from 'vs/platform/telemetry/common/telemetryUtils';
|
||||
import { workbenchInstantiationService, TestEditorGroup, TestEditorGroupsService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { workbenchInstantiationService, TestEditorGroupView, TestEditorGroupsService, TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IEditorRegistry, Extensions, EditorDescriptor } from 'vs/workbench/browser/editor';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { dispose } from 'vs/base/common/lifecycle';
|
||||
|
||||
const NullThemeService = new TestThemeService();
|
||||
|
||||
@@ -50,6 +50,10 @@ export class MyOtherEditor extends BaseEditor {
|
||||
|
||||
class MyInputFactory implements IEditorInputFactory {
|
||||
|
||||
canSerialize(editorInput: EditorInput): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
serialize(input: EditorInput): string {
|
||||
return input.toString();
|
||||
}
|
||||
@@ -98,7 +102,7 @@ suite('Workbench base editor', () => {
|
||||
await e.setInput(input, options, CancellationToken.None);
|
||||
assert.strictEqual(input, e.input);
|
||||
assert.strictEqual(options, e.options);
|
||||
const group = new TestEditorGroup(1);
|
||||
const group = new TestEditorGroupView(1);
|
||||
e.setVisible(true, group);
|
||||
assert(e.isVisible());
|
||||
assert.equal(e.group, group);
|
||||
@@ -127,8 +131,8 @@ suite('Workbench base editor', () => {
|
||||
let oldEditorsCnt = EditorRegistry.getEditors().length;
|
||||
let oldInputCnt = (<any>EditorRegistry).getEditorInputs().length;
|
||||
|
||||
EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyInput)]);
|
||||
EditorRegistry.registerEditor(d2, [new SyncDescriptor(MyInput), new SyncDescriptor(MyOtherInput)]);
|
||||
const dispose1 = EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyInput)]);
|
||||
const dispose2 = EditorRegistry.registerEditor(d2, [new SyncDescriptor(MyInput), new SyncDescriptor(MyOtherInput)]);
|
||||
|
||||
assert.equal(EditorRegistry.getEditors().length, oldEditorsCnt + 2);
|
||||
assert.equal((<any>EditorRegistry).getEditorInputs().length, oldInputCnt + 3);
|
||||
@@ -139,62 +143,52 @@ suite('Workbench base editor', () => {
|
||||
assert.strictEqual(EditorRegistry.getEditorById('id1'), d1);
|
||||
assert.strictEqual(EditorRegistry.getEditorById('id2'), d2);
|
||||
assert(!EditorRegistry.getEditorById('id3'));
|
||||
|
||||
dispose([dispose1, dispose2]);
|
||||
});
|
||||
|
||||
test('Editor Lookup favors specific class over superclass (match on specific class)', function () {
|
||||
let d1 = EditorDescriptor.create(MyEditor, 'id1', 'name');
|
||||
let d2 = EditorDescriptor.create(MyOtherEditor, 'id2', 'name');
|
||||
|
||||
let oldEditors = EditorRegistry.getEditors();
|
||||
(<any>EditorRegistry).setEditors([]);
|
||||
const disposable = EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyResourceInput)]);
|
||||
|
||||
EditorRegistry.registerEditor(d2, [new SyncDescriptor(ResourceEditorInput)]);
|
||||
EditorRegistry.registerEditor(d1, [new SyncDescriptor(MyResourceInput)]);
|
||||
|
||||
let inst = new TestInstantiationService();
|
||||
let inst = workbenchInstantiationService();
|
||||
|
||||
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
|
||||
assert.strictEqual(editor.getId(), 'myEditor');
|
||||
|
||||
const otherEditor = EditorRegistry.getEditor(inst.createInstance(ResourceEditorInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
|
||||
assert.strictEqual(otherEditor.getId(), 'myOtherEditor');
|
||||
assert.strictEqual(otherEditor.getId(), 'workbench.editors.textResourceEditor');
|
||||
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
disposable.dispose();
|
||||
});
|
||||
|
||||
test('Editor Lookup favors specific class over superclass (match on super class)', function () {
|
||||
let d1 = EditorDescriptor.create(MyOtherEditor, 'id1', 'name');
|
||||
|
||||
let oldEditors = EditorRegistry.getEditors();
|
||||
(<any>EditorRegistry).setEditors([]);
|
||||
|
||||
EditorRegistry.registerEditor(d1, [new SyncDescriptor(ResourceEditorInput)]);
|
||||
|
||||
let inst = new TestInstantiationService();
|
||||
let inst = workbenchInstantiationService();
|
||||
|
||||
const editor = EditorRegistry.getEditor(inst.createInstance(MyResourceInput, 'fake', '', URI.file('/fake'), undefined))!.instantiate(inst);
|
||||
assert.strictEqual('myOtherEditor', editor.getId());
|
||||
|
||||
(<any>EditorRegistry).setEditors(oldEditors);
|
||||
assert.strictEqual('workbench.editors.textResourceEditor', editor.getId());
|
||||
});
|
||||
|
||||
test('Editor Input Factory', function () {
|
||||
workbenchInstantiationService().invokeFunction(accessor => EditorInputRegistry.start(accessor));
|
||||
EditorInputRegistry.registerEditorInputFactory('myInputId', MyInputFactory);
|
||||
const disposable = EditorInputRegistry.registerEditorInputFactory('myInputId', MyInputFactory);
|
||||
|
||||
let factory = EditorInputRegistry.getEditorInputFactory('myInputId');
|
||||
assert(factory);
|
||||
|
||||
disposable.dispose();
|
||||
});
|
||||
|
||||
test('EditorMemento - basics', function () {
|
||||
const testGroup0 = new TestEditorGroup(0);
|
||||
const testGroup1 = new TestEditorGroup(1);
|
||||
const testGroup4 = new TestEditorGroup(4);
|
||||
const testGroup0 = new TestEditorGroupView(0);
|
||||
const testGroup1 = new TestEditorGroupView(1);
|
||||
const testGroup4 = new TestEditorGroupView(4);
|
||||
|
||||
const editorGroupService = new TestEditorGroupsService([
|
||||
testGroup0,
|
||||
testGroup1,
|
||||
new TestEditorGroup(2)
|
||||
new TestEditorGroupView(2)
|
||||
]);
|
||||
|
||||
interface TestViewState {
|
||||
@@ -255,7 +249,7 @@ suite('Workbench base editor', () => {
|
||||
});
|
||||
|
||||
test('EditoMemento - use with editor input', function () {
|
||||
const testGroup0 = new TestEditorGroup(0);
|
||||
const testGroup0 = new TestEditorGroupView(0);
|
||||
|
||||
interface TestViewState {
|
||||
line: number;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { ContributableViewsModel, ViewsService, IViewState } from 'vs/workbench/browser/parts/views/views';
|
||||
import { IViewsRegistry, IViewDescriptor, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewsService } from 'vs/workbench/common/views';
|
||||
import { IViewsRegistry, IViewDescriptor, IViewContainersRegistry, Extensions as ViewContainerExtensions, IViewsService, ViewContainerLocation } from 'vs/workbench/common/views';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { move } from 'vs/base/common/arrays';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
@@ -15,7 +15,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
|
||||
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import sinon = require('sinon');
|
||||
|
||||
const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer('test');
|
||||
const container = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer('test', ViewContainerLocation.Sidebar);
|
||||
const ViewsRegistry = Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry);
|
||||
|
||||
class ViewDescriptorSequence {
|
||||
|
||||
Reference in New Issue
Block a user