From 0c13a193ef29787260a1e20d3024a6ddaf6b4429 Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Tue, 13 Aug 2024 13:43:38 +0100 Subject: [PATCH 1/3] fix create label dialog for edit conn --- src/webview/components/kdbNewConnectionView.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webview/components/kdbNewConnectionView.ts b/src/webview/components/kdbNewConnectionView.ts index 000d8162..5d26fbbd 100644 --- a/src/webview/components/kdbNewConnectionView.ts +++ b/src/webview/components/kdbNewConnectionView.ts @@ -637,6 +637,7 @@ export class KdbNewConnectionView extends LitElement { this.connectionData.connType === 2 ? ServerType.INSIGHTS : ServerType.KDB; return html`
+ ${this.isModalOpen ? this.renderNewLabelModal() : ""}
From 0d5cf4a3604ec02600b93d412b8e2d55af4e5ae6 Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Tue, 13 Aug 2024 13:55:01 +0100 Subject: [PATCH 2/3] fix tests --- test/suite/webview.test.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/suite/webview.test.ts b/test/suite/webview.test.ts index 007d9f2b..df50eb90 100644 --- a/test/suite/webview.test.ts +++ b/test/suite/webview.test.ts @@ -601,11 +601,10 @@ describe("KdbNewConnectionView", () => { view.connectionData = { connType: 0, serverName: "testServer" }; const result = view.renderEditConnectionForm(); - assert.strictEqual(view.isBundledQ, true); assert.strictEqual(view.oldAlias, "testServer"); assert.strictEqual(view.serverType, ServerType.KDB); - assert.strictEqual(result.values[0].includes("Bundled q"), true); + assert.strictEqual(result.values[1].includes("Bundled q"), true); }); it("should set isBundledQ to false and return correct HTML when connType is 1", () => { @@ -616,7 +615,7 @@ describe("KdbNewConnectionView", () => { assert.strictEqual(view.isBundledQ, false); assert.strictEqual(view.oldAlias, "testServer"); assert.strictEqual(view.serverType, ServerType.KDB); - assert.strictEqual(result.values[0].includes("My q"), true); + assert.strictEqual(result.values[1].includes("My q"), true); }); it("should set serverType to INSIGHTS and return correct HTML when connType is 2", () => { @@ -627,7 +626,7 @@ describe("KdbNewConnectionView", () => { assert.strictEqual(view.isBundledQ, false); assert.strictEqual(view.oldAlias, "testServer"); assert.strictEqual(view.serverType, ServerType.INSIGHTS); - assert.strictEqual(result.values[0].includes("Insights"), true); + assert.strictEqual(result.values[1].includes("Insights"), true); }); }); From a88cd26a694272a62642a357a0ba6379bc1a7d98 Mon Sep 17 00:00:00 2001 From: Philip Carneiro Date: Tue, 13 Aug 2024 14:20:55 +0100 Subject: [PATCH 3/3] update tests coverage --- test/suite/webview.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/suite/webview.test.ts b/test/suite/webview.test.ts index df50eb90..d5fd1bc8 100644 --- a/test/suite/webview.test.ts +++ b/test/suite/webview.test.ts @@ -628,6 +628,20 @@ describe("KdbNewConnectionView", () => { assert.strictEqual(view.serverType, ServerType.INSIGHTS); assert.strictEqual(result.values[1].includes("Insights"), true); }); + + it("should set serverType to INSIGHTS and open labels modal", () => { + view.connectionData = { connType: 2, serverName: "testServer" }; + view.openModal(); + + const result = view.renderEditConnectionForm(); + const resultsStrings = JSON.stringify(result); + + assert.strictEqual(view.isBundledQ, false); + assert.strictEqual(view.oldAlias, "testServer"); + assert.strictEqual(view.serverType, ServerType.INSIGHTS); + assert.strictEqual(result.values[1].includes("Insights"), true); + assert.strictEqual(resultsStrings.includes("Add a New Label"), true); + }); }); describe("renderEditConnFields", () => {