mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 01:25:38 -05:00
Fix unstable data-workspace tests (#13824)
* stub file existing validation * add error message * change back to calling dialog.validate() * move tests to separate dialogbase file and add more error message validation
This commit is contained in:
@@ -36,9 +36,7 @@ export abstract class DialogBase {
|
||||
|
||||
protected abstract initialize(view: azdata.ModelView): Promise<void>;
|
||||
|
||||
protected async validate(): Promise<boolean> {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
abstract validate(): Promise<boolean>;
|
||||
|
||||
public async open(): Promise<void> {
|
||||
const tab = azdata.window.createTab('');
|
||||
@@ -77,6 +75,10 @@ export abstract class DialogBase {
|
||||
};
|
||||
}
|
||||
|
||||
public getErrorMessage(): azdata.window.DialogMessage {
|
||||
return this._dialogObject.message;
|
||||
}
|
||||
|
||||
protected createHorizontalContainer(view: azdata.ModelView, items: azdata.Component[]): azdata.FlexContainer {
|
||||
return view.modelBuilder.flexContainer().withItems(items, { CSSStyles: { 'margin-right': '5px', 'margin-bottom': '10px' } }).withLayout({ flexFlow: 'row', alignItems: 'center' }).component();
|
||||
}
|
||||
@@ -159,7 +161,7 @@ export abstract class DialogBase {
|
||||
}
|
||||
}
|
||||
|
||||
protected async validateNewWorkspace(sameFolderAsNewProject: boolean): Promise<boolean> {
|
||||
public async validateNewWorkspace(sameFolderAsNewProject: boolean): Promise<boolean> {
|
||||
// workspace file should end in .code-workspace
|
||||
const workspaceValid = this.workspaceInputBox!.value!.endsWith(constants.WorkspaceFileExtension);
|
||||
if (!workspaceValid) {
|
||||
@@ -171,7 +173,7 @@ export abstract class DialogBase {
|
||||
if (!sameFolderAsNewProject) {
|
||||
const workspaceParentDirectoryExists = await directoryExist(path.dirname(this.workspaceInputBox!.value!));
|
||||
if (!workspaceParentDirectoryExists) {
|
||||
this.showErrorMessage(constants.WorkspaceParentDirectoryNotExistError(this.workspaceInputBox!.value!));
|
||||
this.showErrorMessage(constants.WorkspaceParentDirectoryNotExistError(path.dirname(this.workspaceInputBox!.value!)));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user