mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 10:58:31 -05:00
Merge VS Code 1.23.1 (#1520)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
'use strict';
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { Build, Builder } from 'vs/base/browser/builder';
|
||||
import { Builder, $ } from 'vs/base/browser/builder';
|
||||
import { Part } from 'vs/workbench/browser/part';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
@@ -16,16 +16,16 @@ import { TestWorkspace } from 'vs/platform/workspace/test/common/testWorkspace';
|
||||
|
||||
class MyPart extends Part {
|
||||
|
||||
constructor(private expectedParent: Builder) {
|
||||
constructor(private expectedParent: HTMLElement) {
|
||||
super('myPart', { hasTitle: true }, new TestThemeService());
|
||||
}
|
||||
|
||||
public createTitleArea(parent: Builder): Builder {
|
||||
public createTitleArea(parent: HTMLElement): HTMLElement {
|
||||
assert.strictEqual(parent, this.expectedParent);
|
||||
return super.createTitleArea(parent);
|
||||
}
|
||||
|
||||
public createContentArea(parent: Builder): Builder {
|
||||
public createContentArea(parent: HTMLElement): HTMLElement {
|
||||
assert.strictEqual(parent, this.expectedParent);
|
||||
return super.createContentArea(parent);
|
||||
}
|
||||
@@ -41,22 +41,22 @@ class MyPart2 extends Part {
|
||||
super('myPart2', { hasTitle: true }, new TestThemeService());
|
||||
}
|
||||
|
||||
public createTitleArea(parent: Builder): Builder {
|
||||
return parent.div(function (div) {
|
||||
public createTitleArea(parent: HTMLElement): HTMLElement {
|
||||
return $(parent).div(function (div) {
|
||||
div.span({
|
||||
id: 'myPart.title',
|
||||
innerHtml: 'Title'
|
||||
});
|
||||
});
|
||||
}).getHTMLElement();
|
||||
}
|
||||
|
||||
public createContentArea(parent: Builder): Builder {
|
||||
return parent.div(function (div) {
|
||||
public createContentArea(parent: HTMLElement): HTMLElement {
|
||||
return $(parent).div(function (div) {
|
||||
div.span({
|
||||
id: 'myPart.content',
|
||||
innerHtml: 'Content'
|
||||
});
|
||||
});
|
||||
}).getHTMLElement();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,17 +66,17 @@ class MyPart3 extends Part {
|
||||
super('myPart2', { hasTitle: false }, new TestThemeService());
|
||||
}
|
||||
|
||||
public createTitleArea(parent: Builder): Builder {
|
||||
public createTitleArea(parent: HTMLElement): HTMLElement {
|
||||
return null;
|
||||
}
|
||||
|
||||
public createContentArea(parent: Builder): Builder {
|
||||
return parent.div(function (div) {
|
||||
public createContentArea(parent: HTMLElement): HTMLElement {
|
||||
return $(parent).div(function (div) {
|
||||
div.span({
|
||||
id: 'myPart.content',
|
||||
innerHtml: 'Content'
|
||||
});
|
||||
});
|
||||
}).getHTMLElement();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,14 +97,13 @@ suite('Workbench Part', () => {
|
||||
});
|
||||
|
||||
test('Creation', function () {
|
||||
let b = Build.withElementById(fixtureId);
|
||||
let b = new Builder(document.getElementById(fixtureId));
|
||||
b.div().hide();
|
||||
|
||||
let part = new MyPart(b);
|
||||
part.create(b);
|
||||
let part = new MyPart(b.getHTMLElement());
|
||||
part.create(b.getHTMLElement());
|
||||
|
||||
assert.strictEqual(part.getId(), 'myPart');
|
||||
assert.strictEqual(part.getContainer(), b);
|
||||
|
||||
// Memento
|
||||
let memento = part.getMemento(storage);
|
||||
@@ -115,7 +114,7 @@ suite('Workbench Part', () => {
|
||||
part.shutdown();
|
||||
|
||||
// Re-Create to assert memento contents
|
||||
part = new MyPart(b);
|
||||
part = new MyPart(b.getHTMLElement());
|
||||
|
||||
memento = part.getMemento(storage);
|
||||
assert(memento);
|
||||
@@ -127,31 +126,31 @@ suite('Workbench Part', () => {
|
||||
delete memento.bar;
|
||||
|
||||
part.shutdown();
|
||||
part = new MyPart(b);
|
||||
part = new MyPart(b.getHTMLElement());
|
||||
memento = part.getMemento(storage);
|
||||
assert(memento);
|
||||
assert.strictEqual(Types.isEmptyObject(memento), true);
|
||||
});
|
||||
|
||||
test('Part Layout with Title and Content', function () {
|
||||
let b = Build.withElementById(fixtureId);
|
||||
let b = new Builder(document.getElementById(fixtureId));
|
||||
b.div().hide();
|
||||
|
||||
let part = new MyPart2();
|
||||
part.create(b);
|
||||
part.create(b.getHTMLElement());
|
||||
|
||||
assert(Build.withElementById('myPart.title'));
|
||||
assert(Build.withElementById('myPart.content'));
|
||||
assert(document.getElementById('myPart.title'));
|
||||
assert(document.getElementById('myPart.content'));
|
||||
});
|
||||
|
||||
test('Part Layout with Content only', function () {
|
||||
let b = Build.withElementById(fixtureId);
|
||||
let b = new Builder(document.getElementById(fixtureId));
|
||||
b.div().hide();
|
||||
|
||||
let part = new MyPart3();
|
||||
part.create(b);
|
||||
part.create(b.getHTMLElement());
|
||||
|
||||
assert(!Build.withElementById('myPart.title'));
|
||||
assert(Build.withElementById('myPart.content'));
|
||||
assert(!document.getElementById('myPart.title'));
|
||||
assert(document.getElementById('myPart.content'));
|
||||
});
|
||||
});
|
||||
@@ -27,7 +27,7 @@ let EditorInputRegistry: IEditorInputFactoryRegistry = Platform.Registry.as(Edit
|
||||
|
||||
export class MyEditor extends BaseEditor {
|
||||
|
||||
constructor( @ITelemetryService telemetryService: ITelemetryService) {
|
||||
constructor(@ITelemetryService telemetryService: ITelemetryService) {
|
||||
super('MyEditor', NullTelemetryService, NullThemeService);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export class MyEditor extends BaseEditor {
|
||||
|
||||
export class MyOtherEditor extends BaseEditor {
|
||||
|
||||
constructor( @ITelemetryService telemetryService: ITelemetryService) {
|
||||
constructor(@ITelemetryService telemetryService: ITelemetryService) {
|
||||
super('myOtherEditor', NullTelemetryService, NullThemeService);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class MyResourceInput extends ResourceEditorInput { }
|
||||
|
||||
suite('Workbench BaseEditor', () => {
|
||||
|
||||
test('BaseEditor API', function (done) {
|
||||
test('BaseEditor API', function () {
|
||||
let e = new MyEditor(NullTelemetryService);
|
||||
let input = new MyOtherInput();
|
||||
let options = new EditorOptions();
|
||||
@@ -109,7 +109,7 @@ suite('Workbench BaseEditor', () => {
|
||||
assert(!e.isVisible());
|
||||
assert(!e.input);
|
||||
assert(!e.options);
|
||||
e.setInput(input, options).then(() => {
|
||||
return e.setInput(input, options).then(() => {
|
||||
assert.strictEqual(input, e.input);
|
||||
assert.strictEqual(options, e.options);
|
||||
|
||||
@@ -125,7 +125,7 @@ suite('Workbench BaseEditor', () => {
|
||||
assert(!e.input);
|
||||
assert(!e.options);
|
||||
assert(!e.getControl());
|
||||
}).done(() => done());
|
||||
});
|
||||
});
|
||||
|
||||
test('EditorDescriptor', function () {
|
||||
|
||||
@@ -202,7 +202,7 @@ class TestEditorInputFactory implements IEditorInputFactory {
|
||||
}
|
||||
}
|
||||
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).registerEditorInputFactory('testEditorInput', TestEditorInputFactory);
|
||||
(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)).registerEditorInputFactory('testEditorInput', TestEditorInputFactory);
|
||||
|
||||
suite('Editor Stacks Model', () => {
|
||||
|
||||
@@ -1202,7 +1202,7 @@ suite('Editor Stacks Model', () => {
|
||||
config.setUserConfiguration('workbench', { editor: { openPositioning: 'right' } });
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
let group = model.openGroup('group');
|
||||
@@ -1247,7 +1247,7 @@ suite('Editor Stacks Model', () => {
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
|
||||
@@ -1330,7 +1330,7 @@ suite('Editor Stacks Model', () => {
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
|
||||
@@ -1381,7 +1381,7 @@ suite('Editor Stacks Model', () => {
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, true);
|
||||
|
||||
@@ -1422,7 +1422,7 @@ suite('Editor Stacks Model', () => {
|
||||
config.setUserConfiguration('workbench', { editor: { openPositioning: 'right' } });
|
||||
inst.stub(IConfigurationService, config);
|
||||
|
||||
(<IEditorInputFactoryRegistry>Registry.as(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
(Registry.as<IEditorInputFactoryRegistry>(EditorExtensions.EditorInputFactories)).setInstantiationService(inst);
|
||||
|
||||
let model: EditorStacksModel = inst.createInstance(EditorStacksModel, false);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import { TestEditorService, workbenchInstantiationService } from 'vs/workbench/t
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ModeServiceImpl } from 'vs/editor/common/services/modeServiceImpl';
|
||||
import WorkbenchEditorService = require('vs/workbench/services/editor/common/editorService');
|
||||
import * as WorkbenchEditorService from 'vs/workbench/services/editor/common/editorService';
|
||||
import { RangeHighlightDecorations } from 'vs/workbench/browser/parts/editor/rangeDecorations';
|
||||
import { TextModel } from 'vs/editor/common/model/textModel';
|
||||
import { createTestCodeEditor } from 'vs/editor/test/browser/testCodeEditor';
|
||||
|
||||
@@ -0,0 +1,242 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { ContributableViewsModel } from 'vs/workbench/browser/parts/views/contributableViews';
|
||||
import { ViewLocation, ViewsRegistry, IViewDescriptor } from 'vs/workbench/common/views';
|
||||
import { ContextKeyService } from 'vs/platform/contextkey/browser/contextKeyService';
|
||||
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { SimpleConfigurationService } from 'vs/editor/standalone/browser/simpleServices';
|
||||
import { IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { move } from 'vs/base/common/arrays';
|
||||
|
||||
const location = ViewLocation.register('test');
|
||||
|
||||
class ViewDescriptorSequence {
|
||||
|
||||
readonly elements: IViewDescriptor[];
|
||||
private disposables: IDisposable[] = [];
|
||||
|
||||
constructor(model: ContributableViewsModel) {
|
||||
this.elements = [...model.visibleViewDescriptors];
|
||||
model.onDidAdd(({ viewDescriptor, index }) => this.elements.splice(index, 0, viewDescriptor), null, this.disposables);
|
||||
model.onDidRemove(({ viewDescriptor, index }) => this.elements.splice(index, 1), null, this.disposables);
|
||||
model.onDidMove(({ from, to }) => move(this.elements, from.index, to.index), null, this.disposables);
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this.disposables = dispose(this.disposables);
|
||||
}
|
||||
}
|
||||
|
||||
suite('ContributableViewsModel', () => {
|
||||
let contextKeyService: IContextKeyService;
|
||||
|
||||
setup(() => {
|
||||
const configurationService = new SimpleConfigurationService();
|
||||
contextKeyService = new ContextKeyService(configurationService);
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
contextKeyService.dispose();
|
||||
});
|
||||
|
||||
test('empty model', function () {
|
||||
const model = new ContributableViewsModel(location, contextKeyService);
|
||||
assert.equal(model.visibleViewDescriptors.length, 0);
|
||||
});
|
||||
|
||||
test('register/unregister', function () {
|
||||
const model = new ContributableViewsModel(location, contextKeyService);
|
||||
const seq = new ViewDescriptorSequence(model);
|
||||
|
||||
assert.equal(model.visibleViewDescriptors.length, 0);
|
||||
assert.equal(seq.elements.length, 0);
|
||||
|
||||
const viewDescriptor: IViewDescriptor = {
|
||||
id: 'view1',
|
||||
ctor: null,
|
||||
location,
|
||||
name: 'Test View 1'
|
||||
};
|
||||
|
||||
ViewsRegistry.registerViews([viewDescriptor]);
|
||||
|
||||
assert.equal(model.visibleViewDescriptors.length, 1);
|
||||
assert.equal(seq.elements.length, 1);
|
||||
assert.deepEqual(model.visibleViewDescriptors[0], viewDescriptor);
|
||||
assert.deepEqual(seq.elements[0], viewDescriptor);
|
||||
|
||||
ViewsRegistry.deregisterViews(['view1'], location);
|
||||
|
||||
assert.equal(model.visibleViewDescriptors.length, 0);
|
||||
assert.equal(seq.elements.length, 0);
|
||||
});
|
||||
|
||||
test('when contexts', async function () {
|
||||
const model = new ContributableViewsModel(location, contextKeyService);
|
||||
const seq = new ViewDescriptorSequence(model);
|
||||
|
||||
assert.equal(model.visibleViewDescriptors.length, 0);
|
||||
assert.equal(seq.elements.length, 0);
|
||||
|
||||
const viewDescriptor: IViewDescriptor = {
|
||||
id: 'view1',
|
||||
ctor: null,
|
||||
location,
|
||||
name: 'Test View 1',
|
||||
when: ContextKeyExpr.equals('showview1', true)
|
||||
};
|
||||
|
||||
ViewsRegistry.registerViews([viewDescriptor]);
|
||||
assert.equal(model.visibleViewDescriptors.length, 0, 'view should not appear since context isnt in');
|
||||
assert.equal(seq.elements.length, 0);
|
||||
|
||||
const key = contextKeyService.createKey('showview1', false);
|
||||
assert.equal(model.visibleViewDescriptors.length, 0, 'view should still not appear since showview1 isnt true');
|
||||
assert.equal(seq.elements.length, 0);
|
||||
|
||||
key.set(true);
|
||||
await new Promise(c => setTimeout(c, 30));
|
||||
assert.equal(model.visibleViewDescriptors.length, 1, 'view should appear');
|
||||
assert.equal(seq.elements.length, 1);
|
||||
assert.deepEqual(model.visibleViewDescriptors[0], viewDescriptor);
|
||||
assert.equal(seq.elements[0], viewDescriptor);
|
||||
|
||||
key.set(false);
|
||||
await new Promise(c => setTimeout(c, 30));
|
||||
assert.equal(model.visibleViewDescriptors.length, 0, 'view should disappear');
|
||||
assert.equal(seq.elements.length, 0);
|
||||
|
||||
ViewsRegistry.deregisterViews(['view1'], location);
|
||||
assert.equal(model.visibleViewDescriptors.length, 0, 'view should not be there anymore');
|
||||
assert.equal(seq.elements.length, 0);
|
||||
|
||||
key.set(true);
|
||||
await new Promise(c => setTimeout(c, 30));
|
||||
assert.equal(model.visibleViewDescriptors.length, 0, 'view should not be there anymore');
|
||||
assert.equal(seq.elements.length, 0);
|
||||
});
|
||||
|
||||
test('when contexts - multiple', async function () {
|
||||
const model = new ContributableViewsModel(location, contextKeyService);
|
||||
const seq = new ViewDescriptorSequence(model);
|
||||
|
||||
const view1: IViewDescriptor = { id: 'view1', ctor: null, location, name: 'Test View 1' };
|
||||
const view2: IViewDescriptor = { id: 'view2', ctor: null, location, name: 'Test View 2', when: ContextKeyExpr.equals('showview2', true) };
|
||||
|
||||
ViewsRegistry.registerViews([view1, view2]);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1], 'only view1 should be visible');
|
||||
assert.deepEqual(seq.elements, [view1], 'only view1 should be visible');
|
||||
|
||||
const key = contextKeyService.createKey('showview2', false);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1], 'still only view1 should be visible');
|
||||
assert.deepEqual(seq.elements, [view1], 'still only view1 should be visible');
|
||||
|
||||
key.set(true);
|
||||
await new Promise(c => setTimeout(c, 30));
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view2], 'both views should be visible');
|
||||
assert.deepEqual(seq.elements, [view1, view2], 'both views should be visible');
|
||||
|
||||
ViewsRegistry.deregisterViews([view1.id, view2.id], location);
|
||||
});
|
||||
|
||||
test('when contexts - multiple 2', async function () {
|
||||
const model = new ContributableViewsModel(location, contextKeyService);
|
||||
const seq = new ViewDescriptorSequence(model);
|
||||
|
||||
const view1: IViewDescriptor = { id: 'view1', ctor: null, location, name: 'Test View 1', when: ContextKeyExpr.equals('showview1', true) };
|
||||
const view2: IViewDescriptor = { id: 'view2', ctor: null, location, name: 'Test View 2' };
|
||||
|
||||
ViewsRegistry.registerViews([view1, view2]);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view2], 'only view2 should be visible');
|
||||
assert.deepEqual(seq.elements, [view2], 'only view2 should be visible');
|
||||
|
||||
const key = contextKeyService.createKey('showview1', false);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view2], 'still only view2 should be visible');
|
||||
assert.deepEqual(seq.elements, [view2], 'still only view2 should be visible');
|
||||
|
||||
key.set(true);
|
||||
await new Promise(c => setTimeout(c, 30));
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view2], 'both views should be visible');
|
||||
assert.deepEqual(seq.elements, [view1, view2], 'both views should be visible');
|
||||
|
||||
ViewsRegistry.deregisterViews([view1.id, view2.id], location);
|
||||
});
|
||||
|
||||
test('setVisible', function () {
|
||||
const model = new ContributableViewsModel(location, contextKeyService);
|
||||
const seq = new ViewDescriptorSequence(model);
|
||||
|
||||
const view1: IViewDescriptor = { id: 'view1', ctor: null, location, name: 'Test View 1', canToggleVisibility: true };
|
||||
const view2: IViewDescriptor = { id: 'view2', ctor: null, location, name: 'Test View 2', canToggleVisibility: true };
|
||||
const view3: IViewDescriptor = { id: 'view3', ctor: null, location, name: 'Test View 3', canToggleVisibility: true };
|
||||
|
||||
ViewsRegistry.registerViews([view1, view2, view3]);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view2, view3]);
|
||||
assert.deepEqual(seq.elements, [view1, view2, view3]);
|
||||
|
||||
model.setVisible('view2', true);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view2, view3], 'nothing should happen');
|
||||
assert.deepEqual(seq.elements, [view1, view2, view3]);
|
||||
|
||||
model.setVisible('view2', false);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view3], 'view2 should hide');
|
||||
assert.deepEqual(seq.elements, [view1, view3]);
|
||||
|
||||
model.setVisible('view1', false);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view3], 'view1 should hide');
|
||||
assert.deepEqual(seq.elements, [view3]);
|
||||
|
||||
model.setVisible('view3', false);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [], 'view3 shoud hide');
|
||||
assert.deepEqual(seq.elements, []);
|
||||
|
||||
model.setVisible('view1', true);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1], 'view1 should show');
|
||||
assert.deepEqual(seq.elements, [view1]);
|
||||
|
||||
model.setVisible('view3', true);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view3], 'view3 should show');
|
||||
assert.deepEqual(seq.elements, [view1, view3]);
|
||||
|
||||
model.setVisible('view2', true);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view2, view3], 'view2 should show');
|
||||
assert.deepEqual(seq.elements, [view1, view2, view3]);
|
||||
|
||||
ViewsRegistry.deregisterViews([view1.id, view2.id, view3.id], location);
|
||||
assert.deepEqual(model.visibleViewDescriptors, []);
|
||||
assert.deepEqual(seq.elements, []);
|
||||
});
|
||||
|
||||
test('move', function () {
|
||||
const model = new ContributableViewsModel(location, contextKeyService);
|
||||
const seq = new ViewDescriptorSequence(model);
|
||||
|
||||
const view1: IViewDescriptor = { id: 'view1', ctor: null, location, name: 'Test View 1' };
|
||||
const view2: IViewDescriptor = { id: 'view2', ctor: null, location, name: 'Test View 2' };
|
||||
const view3: IViewDescriptor = { id: 'view3', ctor: null, location, name: 'Test View 3' };
|
||||
|
||||
ViewsRegistry.registerViews([view1, view2, view3]);
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view2, view3], 'model views should be OK');
|
||||
assert.deepEqual(seq.elements, [view1, view2, view3], 'sql views should be OK');
|
||||
|
||||
model.move('view3', 'view1');
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view3, view1, view2], 'view3 should go to the front');
|
||||
assert.deepEqual(seq.elements, [view3, view1, view2]);
|
||||
|
||||
model.move('view1', 'view2');
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view3, view2, view1], 'view1 should go to the end');
|
||||
assert.deepEqual(seq.elements, [view3, view2, view1]);
|
||||
|
||||
model.move('view1', 'view3');
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view3, view2], 'view1 should go to the front');
|
||||
assert.deepEqual(seq.elements, [view1, view3, view2]);
|
||||
|
||||
model.move('view2', 'view3');
|
||||
assert.deepEqual(model.visibleViewDescriptors, [view1, view2, view3], 'view2 should go to the middle');
|
||||
assert.deepEqual(seq.elements, [view1, view2, view3]);
|
||||
});
|
||||
});
|
||||
@@ -8,7 +8,7 @@
|
||||
import * as assert from 'assert';
|
||||
import 'vs/workbench/browser/parts/editor/editor.contribution'; // make sure to load all contributed editor things into tests
|
||||
import { Promise, TPromise } from 'vs/base/common/winjs.base';
|
||||
import Event from 'vs/base/common/event';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { QuickOpenHandlerDescriptor, IQuickOpenRegistry, Extensions as QuickOpenExtensions, QuickOpenAction, QuickOpenHandler } from 'vs/workbench/browser/quickopen';
|
||||
@@ -66,7 +66,7 @@ suite('Workbench QuickOpen', () => {
|
||||
}
|
||||
|
||||
test('QuickOpen Handler and Registry', () => {
|
||||
let registry = (<IQuickOpenRegistry>Registry.as(QuickOpenExtensions.Quickopen));
|
||||
let registry = (Registry.as<IQuickOpenRegistry>(QuickOpenExtensions.Quickopen));
|
||||
let handler = new QuickOpenHandlerDescriptor(
|
||||
TestHandler,
|
||||
'testhandler',
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as Platform from 'vs/platform/registry/common/platform';
|
||||
import { ViewletDescriptor, Extensions, Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import { ViewletDescriptor, Extensions, Viewlet, ViewletRegistry } from 'vs/workbench/browser/viewlet';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
|
||||
suite('Workbench Viewlet', () => {
|
||||
@@ -42,15 +42,15 @@ suite('Workbench Viewlet', () => {
|
||||
});
|
||||
|
||||
test('Viewlet extension point and registration', function () {
|
||||
assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).registerViewlet));
|
||||
assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).getViewlet));
|
||||
assert(Types.isFunction(Platform.Registry.as(Extensions.Viewlets).getViewlets));
|
||||
assert(Types.isFunction(Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet));
|
||||
assert(Types.isFunction(Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet));
|
||||
assert(Types.isFunction(Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets));
|
||||
|
||||
let oldCount = Platform.Registry.as(Extensions.Viewlets).getViewlets().length;
|
||||
let oldCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
|
||||
let d = new ViewletDescriptor(TestViewlet, 'reg-test-id', 'name');
|
||||
Platform.Registry.as(Extensions.Viewlets).registerViewlet(d);
|
||||
Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet(d);
|
||||
|
||||
assert(d === Platform.Registry.as(Extensions.Viewlets).getViewlet('reg-test-id'));
|
||||
assert.equal(oldCount + 1, Platform.Registry.as(Extensions.Viewlets).getViewlets().length);
|
||||
assert(d === Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlet('reg-test-id'));
|
||||
assert.equal(oldCount + 1, Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user