mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-29 16:20:29 -04:00
Remove builder references from options dialog (#4774)
* remove more builder references; remove $ from declarations * fix jquery references * formatting * fixing backup * fix backup box
This commit is contained in:
@@ -7,10 +7,10 @@
|
||||
import * as OptionsDialogHelper from 'sql/workbench/browser/modal/optionsDialogHelper';
|
||||
import { InputBox } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
import * as azdata from 'azdata';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { $ } from 'vs/base/browser/dom';
|
||||
|
||||
suite('Advanced options helper tests', () => {
|
||||
var possibleInputs: string[];
|
||||
@@ -98,9 +98,7 @@ suite('Advanced options helper tests', () => {
|
||||
isArray: undefined
|
||||
};
|
||||
|
||||
|
||||
let builder: Builder = $().div();
|
||||
inputBox = TypeMoq.Mock.ofType(InputBox, TypeMoq.MockBehavior.Loose, builder.getHTMLElement(), null, null);
|
||||
inputBox = TypeMoq.Mock.ofType(InputBox, TypeMoq.MockBehavior.Loose, $('div'), null, null);
|
||||
inputBox.callBase = true;
|
||||
inputBox.setup(x => x.validate()).returns(() => isValid);
|
||||
inputBox.setup(x => x.value).returns(() => inputValue);
|
||||
@@ -412,4 +410,4 @@ suite('Advanced options helper tests', () => {
|
||||
assert.equal(optionsMap['General'].length, 1);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
'use strict';
|
||||
import { OptionsDialog } from 'sql/workbench/browser/modal/optionsDialog';
|
||||
import { AdvancedPropertiesController } from 'sql/parts/connection/connectionDialog/advancedPropertiesController';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { ContextKeyServiceStub } from 'sqltest/stubs/contextKeyServiceStub';
|
||||
import * as azdata from 'azdata';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { $ } from 'vs/base/browser/dom';
|
||||
|
||||
suite('Advanced properties dialog tests', () => {
|
||||
var advancedController: AdvancedPropertiesController;
|
||||
@@ -86,7 +86,6 @@ suite('Advanced properties dialog tests', () => {
|
||||
test('advanced dialog should open when showDialog in advancedController get called', () => {
|
||||
var isAdvancedDialogCalled = false;
|
||||
let options: { [name: string]: any } = {};
|
||||
let builder: Builder = $().div();
|
||||
let advanceDialog = TypeMoq.Mock.ofType(OptionsDialog, TypeMoq.MockBehavior.Strict,
|
||||
'', // title
|
||||
'', // name
|
||||
@@ -102,7 +101,7 @@ suite('Advanced properties dialog tests', () => {
|
||||
isAdvancedDialogCalled = true;
|
||||
});
|
||||
advancedController.advancedDialog = advanceDialog.object;
|
||||
advancedController.showDialog(providerOptions, builder.getHTMLElement(), options);
|
||||
advancedController.showDialog(providerOptions, $('div'), options);
|
||||
assert.equal(isAdvancedDialogCalled, true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,13 +25,13 @@ import { TreeNode } from 'sql/parts/objectExplorer/common/treeNode';
|
||||
import { NodeType } from 'sql/parts/objectExplorer/common/nodeType';
|
||||
import { Tree } from 'vs/base/parts/tree/browser/treeImpl';
|
||||
import { ServerTreeDataSource } from 'sql/parts/objectExplorer/viewlet/serverTreeDataSource';
|
||||
import { Builder, $ } from 'sql/base/browser/builder';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import Severity from 'vs/base/common/severity';
|
||||
import { ObjectExplorerActionsContext, ManageConnectionAction } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
|
||||
import { IConnectionResult, IConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { TreeSelectionHandler } from 'sql/parts/objectExplorer/viewlet/treeSelectionHandler';
|
||||
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
|
||||
import { $ } from 'vs/base/browser/dom';
|
||||
|
||||
suite('SQL Connection Tree Action tests', () => {
|
||||
let errorMessageService: TypeMoq.Mock<ErrorMessageServiceStub>;
|
||||
@@ -400,9 +400,8 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
objectExplorerService.callBase = true;
|
||||
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
|
||||
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
|
||||
let builder: Builder = $().div();
|
||||
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
|
||||
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, builder.getHTMLElement(), { dataSource });
|
||||
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, $('div'), { dataSource });
|
||||
tree.callBase = true;
|
||||
|
||||
tree.setup(x => x.refresh(TypeMoq.It.isAny())).returns(() => Promise.resolve(null));
|
||||
@@ -489,9 +488,8 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
objectExplorerService.callBase = true;
|
||||
objectExplorerService.setup(x => x.getObjectExplorerNode(TypeMoq.It.isAny())).returns(() => tablesNode);
|
||||
objectExplorerService.setup(x => x.refreshTreeNode(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => Promise.resolve([table1Node, table2Node]));
|
||||
let builder: Builder = $().div();
|
||||
var dataSource = new ServerTreeDataSource(objectExplorerService.object, connectionManagementService.object, undefined);
|
||||
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, builder.getHTMLElement(), { dataSource });
|
||||
let tree = TypeMoq.Mock.ofType(Tree, TypeMoq.MockBehavior.Loose, $('div'), { dataSource });
|
||||
tree.callBase = true;
|
||||
|
||||
tree.setup(x => x.refresh(TypeMoq.It.isAny())).returns(() => Promise.resolve(null));
|
||||
@@ -513,4 +511,4 @@ suite('SQL Connection Tree Action tests', () => {
|
||||
}).then(() => done(), (err) => done(err));
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -10,7 +10,6 @@ import { IEditorDescriptor } from 'vs/workbench/browser/editor';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { Memento } from 'vs/workbench/common/memento';
|
||||
import { Builder } from 'sql/base/browser/builder';
|
||||
import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput';
|
||||
|
||||
import { QueryResultsInput } from 'sql/parts/query/common/queryResultsInput';
|
||||
@@ -28,24 +27,17 @@ import * as TypeMoq from 'typemoq';
|
||||
import * as assert from 'assert';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { ConfigurationService } from 'vs/platform/configuration/node/configurationService';
|
||||
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
|
||||
|
||||
suite('SQL QueryEditor Tests', () => {
|
||||
let queryModelService: QueryModelService;
|
||||
let instantiationService: TypeMoq.Mock<InstantiationService>;
|
||||
let themeService: TestThemeService = new TestThemeService();
|
||||
let notificationService: TypeMoq.Mock<INotificationService>;
|
||||
let editorDescriptorService: TypeMoq.Mock<EditorDescriptorService>;
|
||||
let connectionManagementService: TypeMoq.Mock<ConnectionManagementService>;
|
||||
let configurationService: TypeMoq.Mock<ConfigurationService>;
|
||||
let memento: TypeMoq.Mock<Memento>;
|
||||
|
||||
let queryInput: QueryInput;
|
||||
let queryInput2: QueryInput;
|
||||
let parentBuilder: Builder;
|
||||
let mockEditor: any;
|
||||
|
||||
let getQueryEditor = function (): QueryEditor {
|
||||
@@ -64,10 +56,6 @@ suite('SQL QueryEditor Tests', () => {
|
||||
};
|
||||
|
||||
setup(() => {
|
||||
// Setup DOM elements
|
||||
let element = DOM.$('queryEditorParent');
|
||||
parentBuilder = new Builder(element);
|
||||
|
||||
// Create object to mock the Editor classes
|
||||
// QueryResultsEditor fails at runtime due to the way we are importing Angualar,
|
||||
// so a {} mock is used here. This mock simply needs to have empty method stubs
|
||||
@@ -119,23 +107,6 @@ suite('SQL QueryEditor Tests', () => {
|
||||
return { enablePreviewFeatures: true };
|
||||
});
|
||||
|
||||
// Create a QueryInput
|
||||
let filePath = 'file://someFile.sql';
|
||||
let uri: URI = URI.parse(filePath);
|
||||
let fileInput = new UntitledEditorInput(uri, false, '', '', '', instantiationService.object, undefined, undefined);
|
||||
let queryResultsInput: QueryResultsInput = new QueryResultsInput(uri.fsPath, configurationService.object);
|
||||
queryInput = new QueryInput('first', fileInput, queryResultsInput, undefined, undefined, undefined, undefined, undefined);
|
||||
|
||||
// Create a QueryInput to compare to the previous one
|
||||
let filePath2 = 'file://someFile2.sql';
|
||||
let uri2: URI = URI.parse(filePath2);
|
||||
let fileInput2 = new UntitledEditorInput(uri2, false, '', '', '', instantiationService.object, undefined, undefined);
|
||||
let queryResultsInput2: QueryResultsInput = new QueryResultsInput(uri2.fsPath, configurationService.object);
|
||||
queryInput2 = new QueryInput('second', fileInput2, queryResultsInput2, undefined, undefined, undefined, undefined, undefined);
|
||||
|
||||
// Mock IMessageService
|
||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
|
||||
// Mock ConnectionManagementService
|
||||
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
||||
memento.setup(x => x.getMemento(TypeMoq.It.isAny())).returns(() => void 0);
|
||||
@@ -144,15 +115,12 @@ suite('SQL QueryEditor Tests', () => {
|
||||
connectionManagementService.setup(x => x.isConnected(TypeMoq.It.isAny())).returns(() => false);
|
||||
connectionManagementService.setup(x => x.disconnectEditor(TypeMoq.It.isAny())).returns(() => void 0);
|
||||
connectionManagementService.setup(x => x.ensureDefaultLanguageFlavor(TypeMoq.It.isAnyString())).returns(() => void 0);
|
||||
|
||||
// Create a QueryModelService
|
||||
queryModelService = new QueryModelService(instantiationService.object, notificationService.object);
|
||||
});
|
||||
|
||||
test('createEditor creates only the taskbar', (done) => {
|
||||
// If I call createEditor
|
||||
let editor: QueryEditor = getQueryEditor();
|
||||
editor.createEditor(parentBuilder.getHTMLElement());
|
||||
editor.createEditor(DOM.$('queryEditorParent'));
|
||||
|
||||
// The taskbar should be created
|
||||
assert.equal(!!editor.taskbar, true);
|
||||
|
||||
Reference in New Issue
Block a user