diff --git a/docs/reference/Translations/index.md b/docs/reference/Translations/index.md index 8f0e67354..9b8f6a9a2 100644 --- a/docs/reference/Translations/index.md +++ b/docs/reference/Translations/index.md @@ -5101,8 +5101,8 @@ Translation keys for the `Payroll.PayrollHistory` i18n namespace. | Property | Default value | | ------ | ------ | | `cancelDialog` | | -| `cancelDialog.body` | `"Any changes you have made to this payroll will be saved."` | -| `cancelDialog.deadline` | `"Run this payroll by {{deadline}} to ensure your employees are paid on time."` | +| `cancelDialog.body` | `"You may cancel this payroll and run it again later. Your changes will be saved."` | +| `cancelDialog.deadline` | `"Run this payroll by {{deadline}} to pay your employees on time."` | | `cancelDialog.primaryAction` | `"Yes, cancel payroll"` | | `cancelDialog.secondaryAction` | `"No, go back"` | | `cancelDialog.title` | `"Cancel {{payPeriod}} payroll?"` | @@ -5249,8 +5249,8 @@ Translation keys for the `Payroll.PayrollOverview` i18n namespace. | `backCta` | `"Back"` | | `breadcrumbLabel` | `"Submit"` | | `cancelCta` | `"Cancel payroll"` | -| `cancelDialogDescription` | `"Any changes you have made to this payroll will be saved."` | -| `cancelDialogDescriptionDeadline` | `"Run this payroll by {{deadline}} to ensure your employees are paid on time."` | +| `cancelDialogDescription` | `"You may cancel this payroll and run it again later. Your changes will be saved."` | +| `cancelDialogDescriptionDeadline` | `"Run this payroll by {{deadline}} to pay your employees on time."` | | `cancelDialogTitle` | `"Cancel {{startDate}} - {{endDate}} payroll?"` | | `cancelDialogTitleDismissal` | `"Cancel payroll?"` | | `cancelledEmptyState` | `"This payroll has been cancelled."` | @@ -5258,7 +5258,7 @@ Translation keys for the `Payroll.PayrollOverview` i18n namespace. | `compensationTypeLabels` | | | `compensationTypeLabels.exempt` | `"Salaried / Exempt"` | | `compensationTypeLabels.nonexempt` | `"Hourly / Nonexempt"` | -| `confirmCancelCta` | `" Yes, cancel payroll"` | +| `confirmCancelCta` | `"Yes, cancel payroll"` | | `dataLoadingTitle` | `"Loading payroll..."` | | `dataViews` | | | `dataViews.companyPaysTab` | `"Company pays"` | diff --git a/src/components/Payroll/PayrollConfiguration/PayrollConfiguration.test.tsx b/src/components/Payroll/PayrollConfiguration/PayrollConfiguration.test.tsx index 058e09138..c373e2c50 100644 --- a/src/components/Payroll/PayrollConfiguration/PayrollConfiguration.test.tsx +++ b/src/components/Payroll/PayrollConfiguration/PayrollConfiguration.test.tsx @@ -364,7 +364,7 @@ describe('PayrollConfiguration', () => { await user.click(screen.getByRole('button', { name: /cancel payroll/i })) await waitFor(() => { - expect(screen.getByText(/any changes you have made/i)).toBeInTheDocument() + expect(screen.getByText(/your changes will be saved/i)).toBeInTheDocument() }) await user.click(screen.getByRole('button', { name: /yes, cancel payroll/i })) diff --git a/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.test.tsx b/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.test.tsx index 42e16ddad..5aaa87df6 100644 --- a/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.test.tsx +++ b/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.test.tsx @@ -589,10 +589,10 @@ describe('PayrollOverviewPresentation', () => { await user.click(screen.getByRole('button', { name: /Cancel payroll/i })) await waitFor(() => { - expect(screen.getByText(/Any changes you have made/i)).toBeInTheDocument() + expect(screen.getByText(/Your changes will be saved/i)).toBeInTheDocument() }) - expect(screen.queryByText(/ensure your employees are paid on time/i)).not.toBeInTheDocument() + expect(screen.queryByText(/pay your employees on time/i)).not.toBeInTheDocument() }) it('shows ACH deadline message for direct deposit payrolls', async () => { @@ -627,7 +627,66 @@ describe('PayrollOverviewPresentation', () => { await user.click(screen.getByRole('button', { name: /Cancel payroll/i })) await waitFor(() => { - expect(screen.getByText(/ensure your employees are paid on time/i)).toBeInTheDocument() + expect(screen.getByText(/pay your employees on time/i)).toBeInTheDocument() + }) + }) + + // The dialog previously led with "Any changes you have made to this payroll will be + // saved.", which says nothing about what cancelling does -- it read as stray help text. + // Legacy gws-flows opens with the run-it-again-later clause (SDK-1286). + it('explains that the payroll can be run again later', async () => { + const user = userEvent.setup() + + renderWithProviders( + , + ) + + await waitFor(() => { + expect(screen.getByRole('button', { name: /Cancel payroll/i })).toBeInTheDocument() + }) + await user.click(screen.getByRole('button', { name: /Cancel payroll/i })) + + await waitFor(() => { + expect( + screen.getByText(/You may cancel this payroll and run it again later/i), + ).toBeInTheDocument() + }) + }) + + // Only `time` was interpolated, so the deadline rendered with no date at all. + it('includes the run-by date alongside the time in the deadline line', async () => { + const user = userEvent.setup() + const ddPayroll: PayrollShow = { + ...mockPayrollData, + employeeCompensations: [ + { + paymentMethod: 'Direct Deposit', + excluded: false, + fixedCompensations: [], + hourlyCompensations: [], + paidTimeOff: [], + employeeUuid: 'emp-1', + }, + ], + } + + renderWithProviders( + , + ) + + await waitFor(() => { + expect(screen.getByRole('button', { name: /Cancel payroll/i })).toBeInTheDocument() + }) + await user.click(screen.getByRole('button', { name: /Cancel payroll/i })) + + // "