Distinguish the Dashboard and Plan age-4 figures
Both screens showed an "expiring at age 4" number under near-identical
labels, and they disagreed -- 143 on the Dashboard versus 100 on the Plan
tab for the same parent. Both were correct: the Dashboard reflects the
saved plan, the Plan tab a proposal that has not been applied and which
simulates future recurring wishes.
The numbers are left untouched; forcing them to agree would make one of
them wrong. Instead each label now states its own basis ("om nuvarande
plan följs" / "om detta förslag tillämpas"), and the Plan tab's intro
says outright that the saved plan may differ, and why.
Tests assert the distinguishing copy on both screens so the two cannot
silently drift back to indistinguishable labels.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RXMhc9nT6sNz1SL4j8dznL
This commit is contained in:
@@ -363,6 +363,39 @@ describe('PlanResults', () => {
|
||||
expect(table).toHaveTextContent('10')
|
||||
})
|
||||
|
||||
// The Dashboard's own expiring-at-4 figure reflects the currently saved
|
||||
// plan; this table reflects an unsaved proposal and can legitimately show
|
||||
// a different number. The title/intro must say so, so the two screens are
|
||||
// never mistaken for showing the same thing (types/entities.ts:
|
||||
// PlanAge4Projection vs Age4Projection).
|
||||
it('labels the age-4 projection section as previewing this unsaved proposal, in Swedish', () => {
|
||||
const proposal = buildProposal({
|
||||
age4Projections: [
|
||||
{ parentPersonalDataUuid: 'pd1', childId: 'child1', fourthBirthday: '2030-03-01', projectedLeftAtB4: 106, savableAfterB4: 96, expiringAtB4: 10 },
|
||||
],
|
||||
})
|
||||
renderLocalized(<PlanResults proposal={proposal} members={mockMembers} />, 'sv')
|
||||
|
||||
const section = screen.getByTestId('plan-age4-projections')
|
||||
expect(section).toHaveTextContent('Vid barnets 4-årsdag, om detta förslag tillämpas')
|
||||
expect(section).toHaveTextContent('om just detta förslag tillämpas')
|
||||
expect(section).toHaveTextContent('Din sparade plan')
|
||||
})
|
||||
|
||||
it('labels the age-4 projection section as previewing this unsaved proposal, in English', () => {
|
||||
const proposal = buildProposal({
|
||||
age4Projections: [
|
||||
{ parentPersonalDataUuid: 'pd1', childId: 'child1', fourthBirthday: '2030-03-01', projectedLeftAtB4: 106, savableAfterB4: 96, expiringAtB4: 10 },
|
||||
],
|
||||
})
|
||||
renderLocalized(<PlanResults proposal={proposal} members={mockMembers} />, 'en')
|
||||
|
||||
const section = screen.getByTestId('plan-age4-projections')
|
||||
expect(section).toHaveTextContent("At the child's 4th birthday, if this proposal is applied")
|
||||
expect(section).toHaveTextContent('if this proposal is applied')
|
||||
expect(section).toHaveTextContent('Your saved plan')
|
||||
})
|
||||
|
||||
it('shows an assumed badge for a vacation year with no entered data (§3.2)', () => {
|
||||
const proposal = buildProposal({
|
||||
vacationBalances: [
|
||||
|
||||
Reference in New Issue
Block a user