Skip to content

Commit e885d07

Browse files
committed
Fix line item letters in PdsGoalCalculator
1 parent 1d25db1 commit e885d07

2 files changed

Lines changed: 39 additions & 3 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',

0 commit comments

Comments
 (0)