mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Ensure that we close editors before utils tests (#13391)
This commit is contained in:
@@ -328,7 +328,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
|||||||
if (shouldReveal || this._bookViewer?.visible) {
|
if (shouldReveal || this._bookViewer?.visible) {
|
||||||
bookItem = notebookPath ? await this.findAndExpandParentNode(notebookPath) : undefined;
|
bookItem = notebookPath ? await this.findAndExpandParentNode(notebookPath) : undefined;
|
||||||
// Select + focus item in viewlet if books viewlet is already open, or if we pass in variable
|
// Select + focus item in viewlet if books viewlet is already open, or if we pass in variable
|
||||||
if (bookItem?.contextValue !== 'pinnedNotebook') {
|
if (bookItem?.contextValue && bookItem.contextValue !== 'pinnedNotebook') {
|
||||||
// Note: 3 is the maximum number of levels that the vscode APIs let you expand to
|
// Note: 3 is the maximum number of levels that the vscode APIs let you expand to
|
||||||
await this._bookViewer.reveal(bookItem, { select: true, focus: true, expand: true });
|
await this._bookViewer.reveal(bookItem, { select: true, focus: true, expand: true });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,18 @@ describe('notebookUtils Tests', function (): void {
|
|||||||
let notebookUtils: NotebookUtils = new NotebookUtils();
|
let notebookUtils: NotebookUtils = new NotebookUtils();
|
||||||
let showErrorMessageSpy: sinon.SinonSpy;
|
let showErrorMessageSpy: sinon.SinonSpy;
|
||||||
|
|
||||||
beforeEach(function(): void {
|
beforeEach(function (): void {
|
||||||
showErrorMessageSpy = sinon.spy(vscode.window, 'showErrorMessage');
|
showErrorMessageSpy = sinon.spy(vscode.window, 'showErrorMessage');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(function(): void {
|
afterEach(function (): void {
|
||||||
sinon.restore();
|
sinon.restore();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.beforeAll(async function (): Promise<void> {
|
||||||
|
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
|
||||||
|
});
|
||||||
|
|
||||||
this.afterAll(async function (): Promise<void> {
|
this.afterAll(async function (): Promise<void> {
|
||||||
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
|
await vscode.commands.executeCommand('workbench.action.closeAllEditors');
|
||||||
});
|
});
|
||||||
@@ -109,7 +113,7 @@ describe('notebookUtils Tests', function (): void {
|
|||||||
sinon.replaceGetter(azdata.nb, 'activeNotebookEditor', () => undefined);
|
sinon.replaceGetter(azdata.nb, 'activeNotebookEditor', () => undefined);
|
||||||
await notebookUtils.clearActiveCellOutput();
|
await notebookUtils.clearActiveCellOutput();
|
||||||
should(showErrorMessageSpy.calledOnce).be.true('showErrorMessage should be called exactly once');
|
should(showErrorMessageSpy.calledOnce).be.true('showErrorMessage should be called exactly once');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('does not show error when notebook visible', async function (): Promise<void> {
|
it('does not show error when notebook visible', async function (): Promise<void> {
|
||||||
let mockNotebookEditor = TypeMoq.Mock.ofType<azdata.nb.NotebookEditor>();
|
let mockNotebookEditor = TypeMoq.Mock.ofType<azdata.nb.NotebookEditor>();
|
||||||
|
|||||||
Reference in New Issue
Block a user