diff --git a/frontend/src/__tests__/plans.test.ts b/frontend/src/__tests__/plans.test.ts index 92fa41ddb..777943483 100644 --- a/frontend/src/__tests__/plans.test.ts +++ b/frontend/src/__tests__/plans.test.ts @@ -988,7 +988,12 @@ describe('Plans Module', () => { await new Promise(resolve => setTimeout(resolve, 50)); - expect(mockConfirmDialog).toHaveBeenCalled(); + // The action cancels this scheduled purchase AND disables its plan + // (backend deletePlannedPurchase), so the dialog must say both. + expect(mockConfirmDialog).toHaveBeenCalledWith(expect.objectContaining({ + title: 'Cancel this scheduled purchase?', + body: expect.stringContaining('plan will be disabled'), + })); expect(api.deletePlannedPurchase).toHaveBeenCalledWith('purchase-1'); // Issue #774: after disable the Plans page must refresh so the toggle // reflects the backend's new enabled=false. getPlans is the API call diff --git a/frontend/src/plans.ts b/frontend/src/plans.ts index 25215ab55..049533ea4 100644 --- a/frontend/src/plans.ts +++ b/frontend/src/plans.ts @@ -755,7 +755,7 @@ function renderPlannedPurchaseRow(purchase: PlannedPurchase): string { ${canPauseOrResumePurchase && isPending ? `` : ''} ${canPauseOrResumePurchase && isPaused ? `` : ''} ${canEditPlan ? `` : ''} - ${canDisablePlan ? `` : ''} + ${canDisablePlan ? `` : ''} `; @@ -823,9 +823,10 @@ async function handlePlannedPurchaseAction(action: string, purchaseId: string, p case 'disable': { // Use styled async dialog (11-L2) instead of blocking browser confirm(). const disableOk = await confirmDialog({ - title: 'Disable this plan?', - body: 'The plan will be paused and no purchases will be scheduled. You can re-enable it later from the Plans list.', - confirmLabel: 'Disable plan', + title: 'Cancel this scheduled purchase?', + body: 'This scheduled purchase will be canceled, and its plan will be disabled so no further purchases are scheduled from it. You can re-enable the plan later from the Plans list.', + confirmLabel: 'Cancel purchase and disable plan', + cancelLabel: 'Keep it', destructive: true, }); if (disableOk) {