mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add onClosed event to ModelView dialogs (#17531)
* Add onClosed event to ModelView dialogs * Use defined type * Fix compile * fix tests * fix tests2 * Remove unused
This commit is contained in:
@@ -303,6 +303,7 @@ export function createViewContext(): ViewTestContext {
|
||||
registerCloseValidator: () => { },
|
||||
registerOperation: () => { },
|
||||
onValidityChanged: new vscode.EventEmitter<boolean>().event,
|
||||
onClosed: new vscode.EventEmitter<azdata.window.CloseReason>().event,
|
||||
registerContent: () => { },
|
||||
modelView: undefined!,
|
||||
valid: true
|
||||
|
||||
@@ -55,6 +55,7 @@ export class PublishDatabaseDialog {
|
||||
|
||||
constructor(private project: Project) {
|
||||
this.dialog = utils.getAzdataApi()!.window.createModelViewDialog(constants.publishDialogName, 'sqlProjectPublishDialog');
|
||||
this.toDispose.push(this.dialog.onClosed(_ => this.completionPromise.resolve()));
|
||||
this.publishTab = utils.getAzdataApi()!.window.createTab(constants.publishDialogName);
|
||||
}
|
||||
|
||||
@@ -74,9 +75,6 @@ export class PublishDatabaseDialog {
|
||||
this.dialog.customButtons.push(generateScriptButton);
|
||||
|
||||
utils.getAzdataApi()!.window.openDialog(this.dialog);
|
||||
// Complete the promise when we're done - we use a disposable here instead of a CloseValidator because we have custom buttons (generate script)
|
||||
// which don't go through that logic.
|
||||
this.toDispose.push({ dispose: () => { this.completionPromise.resolve(); } });
|
||||
}
|
||||
|
||||
public waitForClose(): Promise<void> {
|
||||
|
||||
@@ -395,15 +395,13 @@ describe('ProjectsController', function (): void {
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
let dialogPromise = projController.object.publishProject(proj);
|
||||
void projController.object.publishProject(proj);
|
||||
await publishDialog.object.publishClick();
|
||||
await dialogPromise;
|
||||
|
||||
should(holler).equal(publishHoller, 'executionCallback() is supposed to have been setup and called for Publish scenario');
|
||||
|
||||
dialogPromise = projController.object.publishProject(proj);
|
||||
void projController.object.publishProject(proj);
|
||||
await publishDialog.object.generateScriptClick();
|
||||
await dialogPromise;
|
||||
|
||||
should(holler).equal(generateHoller, 'executionCallback() is supposed to have been setup and called for GenerateScript scenario');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user