Skip to content

Commit

Permalink
feat: enable global filter to all dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
RRanath committed Oct 29, 2024
1 parent e7519bf commit e688510
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/components/AnalystDashboard/AllDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
}, [visibilityPreference]);

const state = {
showGlobalFilter: true,
columnFilters,
columnVisibility,
density,
Expand Down Expand Up @@ -621,7 +622,7 @@ const AllDashboardTable: React.FC<Props> = ({ query }) => {
onShowColumnFiltersChange: setShowColumnFilters,
onColumnSizingChange: setColumnSizing,
enablePagination: false,
enableGlobalFilter: false,
enableGlobalFilter: true,
enableBottomToolbar: false,
filterFns: {
filterNumber,
Expand Down
24 changes: 24 additions & 0 deletions app/tests/pages/analyst/dashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -747,4 +747,28 @@ describe('The index page', () => {
expect(cbcFilterCheckbox).toBeChecked();
expect(screen.queryByText('5555')).toBeInTheDocument();
});

it('shows global filter and filters results based on input', async () => {
jest
.spyOn(moduleApi, 'useFeature')
.mockReturnValue(mockShowCbcProjects(true));

pageTestingHelper.loadQuery();
pageTestingHelper.renderPage();

expect(screen.getByText('CCBC-010002')).toBeInTheDocument();
expect(screen.getByText('CCBC-010003')).toBeInTheDocument();

const globalSearch = screen.getByPlaceholderText('Search');
expect(globalSearch).toBeInTheDocument();

fireEvent.change(globalSearch, {
target: { value: 'Test Proj Name 3' },
});

await waitFor(() => {
expect(screen.queryByText('CCBC-010002')).not.toBeInTheDocument();
expect(screen.getByText('CCBC-010003')).toBeInTheDocument();
});
});
});

0 comments on commit e688510

Please sign in to comment.