From e51a3874cacbf5fc4f1cd8afc2b21b8cfe3d96a5 Mon Sep 17 00:00:00 2001 From: Christian Bromann Date: Tue, 6 Sep 2022 21:49:13 +0200 Subject: [PATCH] Offer button to re-open Marquee when color theme was changed (#213) --- packages/extension/src/extension.ts | 5 +++-- packages/extension/tests/extension.test.ts | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/extension/src/extension.ts b/packages/extension/src/extension.ts index 824f81c3..894bf350 100644 --- a/packages/extension/src/extension.ts +++ b/packages/extension/src/extension.ts @@ -68,8 +68,9 @@ export class MarqueeExtension { this.gui.close() vscode.window.showInformationMessage( - 'Please reload your Marquee View to apply the new theme.' - ) + 'Please reload your Marquee View to apply the new theme.', + 'Open Marquee' + ).then((item) => item && this.gui.open()) } /** diff --git a/packages/extension/tests/extension.test.ts b/packages/extension/tests/extension.test.ts index 240f21f1..d5a4fc77 100644 --- a/packages/extension/tests/extension.test.ts +++ b/packages/extension/tests/extension.test.ts @@ -169,3 +169,20 @@ test('_editTreeItem', async () => { `parsedUri-snippet:${filePath}`) expect(vscode.window.showTextDocument).toBeCalledTimes(2) }) + +test('_onColorThemeChange', () => { + const context: any = { subscriptions: [], extensionPath: '/foo/bar' } + const ext = new MarqueeExtension(context) + // @ts-expect-error + ext['gui'] = { + isActive: jest.fn(), + close: jest.fn(), + open: jest.fn() + } + ext['_onColorThemeChange']() + expect(ext['gui'].close).toBeCalledTimes(0) + + ;(ext['gui'].isActive as jest.Mock).mockReturnValue(true) + ext['_onColorThemeChange']() + expect(vscode.window.showInformationMessage).toBeCalledTimes(1) +})