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

MPDX-8421 14month Late Circle #1167

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { render, waitFor } from '@testing-library/react';
import { render, waitFor, within } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import TestRouter from '__tests__/util/TestRouter';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
Expand Down Expand Up @@ -29,7 +29,7 @@ const defaultFourteenMonthReport = {
average: 258,
id: 'contact-1',
lateBy30Days: false,
lateBy60Days: false,
lateBy60Days: true,
months: [
{
donations: [
Expand Down Expand Up @@ -261,6 +261,29 @@ describe('FourteenMonthReportTable', () => {
expect(queryByTestId('FourteenMonthReport')).toBeInTheDocument();
});

it('should should show the dot if a donation is late', async () => {
const { getAllByTestId, queryByTestId } = render(<Components />);

await waitFor(() => {
expect(
queryByTestId('LoadingFourteenMonthReport'),
).not.toBeInTheDocument();
});

const fourteenMonthReportRow = getAllByTestId(
caleballdrin marked this conversation as resolved.
Show resolved Hide resolved
'FourteenMonthReportTableRow',
);
expect(
within(fourteenMonthReportRow[0]).getByTestId('lateCircle60'),
).toBeInTheDocument();

await waitFor(() => {
expect(
within(fourteenMonthReportRow[1]).queryByTestId('lateCircle30'),
).not.toBeInTheDocument();
});
caleballdrin marked this conversation as resolved.
Show resolved Hide resolved
});

it('can make contact click event happen and pledge amount is correct', async () => {
const { getByRole, queryByTestId, getAllByTestId } = render(<Components />);

Expand Down
26 changes: 26 additions & 0 deletions src/components/Reports/FourteenMonthReports/Layout/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
TableBody,
TableContainer,
TableRow,
Tooltip,
Typography,
} from '@mui/material';
import { styled } from '@mui/material/styles';
Expand Down Expand Up @@ -140,6 +141,31 @@ export const FourteenMonthReportTable: React.FC<
<Link>{contact.name}</Link>
</NextLink>
</NameTypography>
{(contact.lateBy30Days || contact.lateBy60Days) && (
<Tooltip
title={t('{{daysLate}}+ days late', {
daysLate: contact.lateBy60Days ? '60' : '30',
})}
arrow
>
<Box
sx={{
caleballdrin marked this conversation as resolved.
Show resolved Hide resolved
bgcolor: contact.lateBy60Days ? 'red' : 'orange',
width: 15,
height: 15,
borderRadius: '50%',
flex: 'none',
marginLeft: 'auto',
'@media print': {
display: 'none',
},
}}
data-testid={`lateCircle${
contact.lateBy60Days ? '60' : '30'
}`}
/>
</Tooltip>
)}
</Box>
{isExpanded && (
<Typography variant="body2" color="textSecondary">
Expand Down
Loading