Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Enhancement) Filter by should default to Pending Bills #47

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bills-table/bills-table.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const BillsTable = () => {
const config = useConfig();
const layout = useLayoutType();
const responsiveSize = isDesktop(layout) ? 'sm' : 'lg';
const [billPaymentStatus, setBillPaymentStatus] = useState('');
const [billPaymentStatus, setBillPaymentStatus] = useState('PENDING');
const pageSizes = config?.bills?.pageSizes ?? [10, 20, 30, 40, 50];
const [pageSize, setPageSize] = useState(config?.bills?.pageSize ?? 10);
const { bills, isLoading, isValidating, error } = useBills('', billPaymentStatus);
Expand Down Expand Up @@ -152,7 +152,7 @@ const BillsTable = () => {
className={styles.filterDropdown}
direction="bottom"
id={`filter-${id}`}
initialSelectedItem={filterItems[0]}
initialSelectedItem={filterItems[1]}
items={filterItems}
itemToString={(item) => (item ? item.text : '')}
label=""
Expand Down
10 changes: 5 additions & 5 deletions src/bills-table/bills-table.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ describe('BillsTable', () => {
// Should filter the table when bill payment status combobox is changed
const billCategorySelect = screen.getByRole('combobox');
expect(billCategorySelect).toBeInTheDocument();
await user.click(billCategorySelect, { name: 'All bills' });
expect(mockbills).toHaveBeenCalledWith('', '');

await user.click(screen.getByText('Pending bills'));
expect(screen.getByText('Pending bills')).toBeInTheDocument();
await user.click(billCategorySelect, { name: 'Pending bills' });
expect(mockbills).toHaveBeenCalledWith('', 'PENDING');

await user.click(screen.getByText('All bills'));
expect(screen.getByText('All bills')).toBeInTheDocument();
expect(mockbills).toHaveBeenCalledWith('', '');
});

test('should show the loading spinner while retrieving data', () => {
Expand Down
Loading