Skip to content
Snippets Groups Projects
Commit a14466e8 authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

added comment to unit test

parent e933cfc8
No related branches found
No related tags found
1 merge request!1174Resolve TMS-2810 "Test fixes part 3"
......@@ -28,8 +28,8 @@ describe('PanelButtons', () => {
});
it('adjusts left panel size when summary is not active', async () => {
const setLeftPanelSizeMock = jest.fn();
const pannelComponent = render(<PanelButtons
let setLeftPanelSizeMock = jest.fn();
const pannelComponent = render(<PanelButtons
showLegendbar={false}
setShowLegendbar={jest.fn()}
showListTabs={true}
......@@ -38,7 +38,7 @@ describe('PanelButtons', () => {
leftPanelSize={20}
setLeftPanelSize={setLeftPanelSizeMock} />);
await waitFor(() => expect(pannelComponent.getByTitle(shrinkLabel).tobeinTheDocument));
await waitFor(() => expect(pannelComponent.getByTitle(shrinkLabel).tobeinTheDocument));
const shrinkButton = pannelComponent.getByTitle(shrinkLabel);
clickItem(shrinkButton)
expect(setLeftPanelSizeMock).toHaveBeenCalledWith(10); // 10% shrink
......@@ -47,11 +47,16 @@ describe('PanelButtons', () => {
clickItem(expandButton)
expect(setLeftPanelSizeMock).toHaveBeenCalledWith(30); // 10% expand
setLeftPanelSizeMock=null;
});
// this test can fail, allthough it's good. SOmething with Jest and React 18 running compatibility mode
it('disables resize buttons when summary is active', async () => {
const pannelComponent = render(<PanelButtons
let pannelComponentb = render(<PanelButtons
showLegendbar={false}
setShowLegendbar={jest.fn()}
showListTabs={true}
......@@ -60,12 +65,13 @@ describe('PanelButtons', () => {
leftPanelSize={20}
setLeftPanelSize={ jest.fn()} />);
await waitFor(() => expect(pannelComponent.getByTitle(shrinkLabel)));
const shrinkButton = pannelComponent.getByTitle(shrinkLabel);
await waitFor(() => expect(pannelComponentb.getByTitle(shrinkLabel).tobeinTheDocument));
const shrinkButton = pannelComponentb.getByTitle(shrinkLabel);
expect(shrinkButton).toHaveAttribute("disabled")
const expandButton = pannelComponent.getByTitle(expandLabel);
const expandButton = pannelComponentb.getByTitle(expandLabel);
expect(expandButton).toHaveAttribute("disabled")
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment