diff --git a/extensions/ql-vscode/src/view/method-modeling/__tests__/MultipleModeledMethodsPanel.spec.tsx b/extensions/ql-vscode/src/view/method-modeling/__tests__/MultipleModeledMethodsPanel.spec.tsx index 54616a606..a04fd8a66 100644 --- a/extensions/ql-vscode/src/view/method-modeling/__tests__/MultipleModeledMethodsPanel.spec.tsx +++ b/extensions/ql-vscode/src/view/method-modeling/__tests__/MultipleModeledMethodsPanel.spec.tsx @@ -162,6 +162,30 @@ describe(MultipleModeledMethodsPanel.name, () => { }, ]); }); + + it("changes selection to the newly added modeling", async () => { + const { rerender } = render({ + method, + modeledMethods, + isModelingInProgress, + onChange, + }); + + await userEvent.click(screen.getByLabelText("Add modeling")); + + rerender( + , + ); + + expect(screen.getByText("2/2")).toBeInTheDocument(); + }); }); describe("with two modeled methods", () => { @@ -471,6 +495,32 @@ describe(MultipleModeledMethodsPanel.name, () => { screen.getByText("Error: Conflicting classification"), ).toBeInTheDocument(); }); + + it("changes selection to the newly added modeling", async () => { + const { rerender } = render({ + method, + modeledMethods, + isModelingInProgress, + onChange, + }); + + expect(screen.getByText("1/2")).toBeInTheDocument(); + + await userEvent.click(screen.getByLabelText("Add modeling")); + + rerender( + , + ); + + expect(screen.getByText("3/3")).toBeInTheDocument(); + }); }); describe("with three modeled methods", () => {