Skip to content

Commit

Permalink
feat: Remove the word 'All' from filter status to avoid confusion ENT…
Browse files Browse the repository at this point in the history
…-4684 (#590)

* feat: Remove the word 'All' from filter status to avoid confusion

ENT-4684

ENt-4684

* fix: fix tests

fix test assertions missed in first round
  • Loading branch information
binodpant authored Jul 9, 2021
1 parent 542735f commit 4f4c51b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe('<CourseSearchResults />', () => {
const selection = screen.getByTestId('selectAll');
userEvent.click(selection);

expect(screen.getByText('All 2 selected')).toBeInTheDocument();
expect(screen.getByText('2 selected')).toBeInTheDocument();
});
it('renders a message when there are no results', () => {
const wrapper = mount(<CourseSearchWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('BulkEnrollmentStepper', () => {
const prevButton = screen.getByTestId(PREV_BUTTON_TEST_ID);
userEvent.click(prevButton);
expect(screen.getAllByText(ADD_COURSES_TITLE)).toHaveLength(2);
expect(screen.getByText('All 2 selected')).toBeInTheDocument();
expect(screen.getByText('2 selected')).toBeInTheDocument();
await act(() => mockEmailResponse);
});
it('displays the user emails', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@ const BaseSelectionStatus = ({
selectedRows,
dispatch,
}) => {
const {
itemCount, rows,
} = useContext(DataTableContext);
const isAllRowsSelected = selectedRows.length === itemCount;
const { rows } = useContext(DataTableContext);
const selectedRowIds = selectedRows.map((row) => row.id);
const areAllDisplayedRowsSelected = checkForSelectedRows(selectedRowIds, rows);

const numSelectedRows = selectedRows.length;

return (
<div className={className}>
<span>{isAllRowsSelected && 'All '}{numSelectedRows} selected </span>
<span>{numSelectedRows} selected </span>
{!areAllDisplayedRowsSelected && (
<Button
variant="link"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ describe('BaseSelectionStatus', () => {
{...defaultProps}
selectedRows={defaultDataTableInfo.rows}
/>);
expect(screen.getByText(`All ${defaultDataTableInfo.rows.length} selected`)).toBeInTheDocument();
expect(screen.getByText(`${defaultDataTableInfo.rows.length} selected`)).toBeInTheDocument();
});
});

0 comments on commit 4f4c51b

Please sign in to comment.