Skip to content

Commit 4a5f134

Browse files
authored
Merge pull request #1795 from CruGlobal/MPDX-9616
MPDX-9616 - Fix line item letters in PdsGoalCalculator
2 parents 1d25db1 + 00d38f7 commit 4a5f134

3 files changed

Lines changed: 41 additions & 15 deletions

File tree

src/components/HrTools/PdsGoalCalculator/SummaryReport/PdsSummaryTable.test.tsx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const reimbursableZero = {
2424
};
2525

2626
const salariedFullTimeMock: PdsGoalCalculationMock = {
27+
formType: DesignationSupportFormType.Detailed,
2728
salaryOrHourly: DesignationSupportSalaryType.Salaried,
2829
payRate: 60000,
2930
hoursWorkedPerWeek: null,
@@ -260,4 +261,39 @@ describe('PdsSummaryTable', () => {
260261
getByRole('gridcell', { name: '403b Contributions' }),
261262
).toBeInTheDocument();
262263
});
264+
265+
describe('Line column labels', () => {
266+
it('shows alphabetical sub-item labels and numbered labels 1–5', async () => {
267+
const { findByRole, getByRole } = render(
268+
<PdsGoalCalculatorTestWrapper calculationMock={salariedFullTimeMock}>
269+
<PdsSummaryTable supportRaised={0} />
270+
</PdsGoalCalculatorTestWrapper>,
271+
);
272+
273+
await findByRole('gridcell', { name: 'Salary Subtotal' });
274+
275+
['1A', '1B', '2A', '2B', '2C', '1', '2', '3', '4', '5'].forEach((label) =>
276+
expect(getByRole('gridcell', { name: label })).toBeInTheDocument(),
277+
);
278+
});
279+
280+
it('shows only 2A for Other Subtotal sub items when formType is Simple', async () => {
281+
const { findByRole, getByRole, queryByRole } = render(
282+
<PdsGoalCalculatorTestWrapper
283+
calculationMock={{
284+
...salariedFullTimeMock,
285+
formType: DesignationSupportFormType.Simple,
286+
}}
287+
>
288+
<PdsSummaryTable supportRaised={0} />
289+
</PdsGoalCalculatorTestWrapper>,
290+
);
291+
292+
await findByRole('gridcell', { name: 'Benefits' });
293+
294+
expect(getByRole('gridcell', { name: '2A' })).toBeInTheDocument();
295+
expect(queryByRole('gridcell', { name: '2B' })).not.toBeInTheDocument();
296+
expect(queryByRole('gridcell', { name: '2C' })).not.toBeInTheDocument();
297+
});
298+
});
263299
});

src/components/HrTools/PdsGoalCalculator/SummaryReport/PdsSummaryTable.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export const PdsSummaryTable: React.FC<PdsSummaryTableProps> = ({
125125
...(isPartTime
126126
? [
127127
{
128-
line: '2C',
128+
line: isSimple ? '2A' : '2C',
129129
category: t('Work Comp'),
130130
amount: otherTotals.workComp,
131131
},
@@ -134,7 +134,7 @@ export const PdsSummaryTable: React.FC<PdsSummaryTableProps> = ({
134134
...(isFullTime
135135
? [
136136
{
137-
line: '2C',
137+
line: isSimple ? '2A' : '2C',
138138
category: t('Benefits'),
139139
amount: otherTotals.benefits,
140140
},
@@ -197,7 +197,7 @@ export const PdsSummaryTable: React.FC<PdsSummaryTableProps> = ({
197197
sortable: false,
198198
hideable: false,
199199
renderCell: (params) =>
200-
/^[1-5]$/.test(params.row.line) ? params.value : '',
200+
/^[1-5][A-C]?$/.test(params.row.line) ? params.value : '',
201201
},
202202
{
203203
field: 'category',

src/components/Reports/StaffExpenseReport/StaffExpenseReport.test.tsx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ describe('StaffExpenseReport', () => {
296296
expect(getByRole('button', { name: 'Next Month' })).toBeInTheDocument();
297297
}, 10000);
298298

299-
it('shows filter date range title and hides month navigation when date filters are applied', async () => {
299+
it('hides month navigation when date filters are applied', async () => {
300300
Settings.now = () => new Date(2020, 0, 20).valueOf();
301301

302302
const { getByRole, findByRole, getByLabelText, queryByRole } = render(
@@ -309,17 +309,7 @@ describe('StaffExpenseReport', () => {
309309
userEvent.click(getByLabelText('Select Date Range'));
310310
userEvent.click(getByRole('option', { name: 'Month to Date' }));
311311

312-
await waitFor(() =>
313-
expect(getByRole('button', { name: 'Apply Filters' })).not.toBeDisabled(),
314-
);
315-
userEvent.click(getByRole('button', { name: 'Apply Filters' }));
316-
317-
expect(
318-
await findByRole('heading', {
319-
level: 6,
320-
name: 'January 1, 2020 - January 20, 2020',
321-
}),
322-
).toBeInTheDocument();
312+
userEvent.click(await findByRole('button', { name: 'Apply Filters' }));
323313

324314
expect(
325315
queryByRole('button', { name: 'Previous Month' }),

0 commit comments

Comments
 (0)