diff --git a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/PanelButtons.test.js b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/PanelButtons.test.js index 553b90a811852c5b6688fecb1906968bf46984bb..00b2ffe6c76cfd77e54211eea659620dd67cef37 100644 --- a/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/PanelButtons.test.js +++ b/SAS/TMSS/frontend/tmss_webapp/src/routes/Timeline/components/PanelButtons.test.js @@ -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") }); - }); +