Skip to content

Commit

Permalink
Offer button to re-open Marquee when color theme was changed (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-bromann authored Sep 6, 2022
1 parent f868927 commit e51a387
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/extension/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

/**
Expand Down
17 changes: 17 additions & 0 deletions packages/extension/tests/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

0 comments on commit e51a387

Please sign in to comment.