From 60ab19f2b58c3f9da8af1bc922e0af3c53eb7693 Mon Sep 17 00:00:00 2001 From: R Ranathunga Date: Thu, 29 Aug 2024 07:25:02 -0700 Subject: [PATCH] gitchore: sticky header on dashboard --- app/tests/pages/analyst/dashboard.test.tsx | 42 +++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/app/tests/pages/analyst/dashboard.test.tsx b/app/tests/pages/analyst/dashboard.test.tsx index bcde59f5a6..f2a148333a 100644 --- a/app/tests/pages/analyst/dashboard.test.tsx +++ b/app/tests/pages/analyst/dashboard.test.tsx @@ -440,7 +440,7 @@ describe('The index page', () => { pageTestingHelper.renderPage(); const countRows = screen.getAllByText(/Showing 8 of 8 rows/i); - expect(countRows).toHaveLength(2); + expect(countRows).toHaveLength(1); }); it('click on table row leads to review page', async () => { @@ -693,6 +693,46 @@ describe('The index page', () => { expect(screen.queryByText('BC-000074')).not.toBeInTheDocument(); }); + it('correctly sorts status columns based on custom order', async () => { + jest + .spyOn(moduleApi, 'useFeature') + .mockReturnValue(mockShowCbcProjects(true)); + + pageTestingHelper.loadQuery(); + pageTestingHelper.renderPage(); + + expect(screen.getByText('5555')).toBeInTheDocument(); + expect(screen.queryByText('CCBC-010004')).toBeInTheDocument(); + expect(screen.queryByText('BC-000074')).toBeInTheDocument(); + const cbcFilterCheckbox = screen.getByTestId('programFilterCbc'); + const ccbcFilterCheckbox = screen.getByTestId('programFilterCcbc'); + const otherFilterCheckbox = screen.getByTestId('programFilterOther'); + expect(cbcFilterCheckbox).toBeChecked(); + expect(ccbcFilterCheckbox).toBeChecked(); + expect(otherFilterCheckbox).toBeChecked(); + + await act(async () => { + fireEvent.click(cbcFilterCheckbox); + }); + expect(cbcFilterCheckbox).not.toBeChecked(); + + expect(screen.queryByText('5555')).not.toBeInTheDocument(); + + await act(async () => { + fireEvent.click(ccbcFilterCheckbox); + }); + expect(ccbcFilterCheckbox).not.toBeChecked(); + + expect(screen.queryByText('CCBC-010004')).not.toBeInTheDocument(); + + await act(async () => { + fireEvent.click(otherFilterCheckbox); + }); + expect(otherFilterCheckbox).not.toBeChecked(); + + expect(screen.queryByText('BC-000074')).not.toBeInTheDocument(); + }); + it('clear filters correctly restore project type filter', async () => { jest .spyOn(moduleApi, 'useFeature')