Add tests that pagination is updated when add a new model

This commit is contained in:
Robert 2023-10-23 13:46:10 +01:00
Родитель 20469b0da4
Коммит 1424afc7a4
1 изменённых файлов: 50 добавлений и 0 удалений

Просмотреть файл

@ -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(
<MultipleModeledMethodsPanel
method={method}
modeledMethods={
onChange.mock.calls[onChange.mock.calls.length - 1][1]
}
isModelingInProgress={isModelingInProgress}
onChange={onChange}
/>,
);
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(
<MultipleModeledMethodsPanel
method={method}
modeledMethods={
onChange.mock.calls[onChange.mock.calls.length - 1][1]
}
isModelingInProgress={isModelingInProgress}
onChange={onChange}
/>,
);
expect(screen.getByText("3/3")).toBeInTheDocument();
});
});
describe("with three modeled methods", () => {