Skip to content

Commit

Permalink
Merge branch 'master' into bgoddar/updateDevtoolsVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
bgoddar authored Jun 15, 2021
2 parents 0cce570 + 51a39e9 commit 6e00176
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/devtoolsPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,12 @@ export class DevToolsPanel {
config: IRuntimeConfig): void {
const column = vscode.ViewColumn.Beside;

if (DevToolsPanel.instance) {
DevToolsPanel.instance.panel.reveal(column);
if (DevToolsPanel.instance && DevToolsPanel.instance.targetUrl === targetUrl) {
DevToolsPanel.instance.panel.reveal(column);
} else {
if (DevToolsPanel.instance) {
DevToolsPanel.instance.dispose();
}
const panel = vscode.window.createWebviewPanel(SETTINGS_STORE_NAME, SETTINGS_WEBVIEW_NAME, column, {
enableCommandUris: true,
enableScripts: true,
Expand Down
10 changes: 10 additions & 0 deletions test/devtoolsPanel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ describe("devtoolsPanel", () => {
expect(mockPanel.onDidDispose).toHaveBeenCalled();
});

it("switches targets with active session", async () => {
const dtp = await import("../src/devtoolsPanel");
const mockVsCode = jest.requireMock("vscode");

dtp.DevToolsPanel.createOrShow(context, mockTelemetry, "https://www.bing.com/", mockRuntimeConfig);
dtp.DevToolsPanel.createOrShow(context, mockTelemetry, "https://www.microsoft.com/", mockRuntimeConfig);
expect(mockPanel.onDidDispose).toHaveBeenCalledTimes(2);
expect(mockVsCode.window.createWebviewPanel).toHaveBeenCalledTimes(2);
});

it("calls reveal on existing instance", async () => {
const dtp = await import("../src/devtoolsPanel");
dtp.DevToolsPanel.createOrShow(context, mockTelemetry, "", mockRuntimeConfig);
Expand Down

0 comments on commit 6e00176

Please sign in to comment.