From 981b95184753d9e008f0e838aa5c9c9eee677f0e Mon Sep 17 00:00:00 2001 From: Jacob Hagstedt Date: Sun, 20 Sep 2026 07:26:18 +0200 Subject: [PATCH] Hide the birthday legend when it names a single field Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01XBRLomdLK9jF7wU7a8AA6H --- .../inputs/ChildBirthdayInput.test.tsx | 24 +++++++++++++++++++ .../components/inputs/ChildBirthdayInput.tsx | 7 +++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/inputs/ChildBirthdayInput.test.tsx b/frontend/src/components/inputs/ChildBirthdayInput.test.tsx index 4c5ea5d..cfea8a0 100644 --- a/frontend/src/components/inputs/ChildBirthdayInput.test.tsx +++ b/frontend/src/components/inputs/ChildBirthdayInput.test.tsx @@ -113,4 +113,28 @@ describe('ChildBirthdayInput', () => { ) expect(screen.getByTestId('birthday-input-fieldset')).toBeInTheDocument() }) + + it('hides legend when preschool field is not present and shows it when present', () => { + const onBirthDateChange = vi.fn() + const onPreschoolStartDateChange = vi.fn() + + // Without preschool field + const { rerender } = render( + + ) + expect(screen.getByTestId('birthday-legend')).toHaveClass('visually-hidden') + + // With preschool field + rerender( + + ) + expect(screen.getByTestId('birthday-legend')).not.toHaveClass('visually-hidden') + }) }) diff --git a/frontend/src/components/inputs/ChildBirthdayInput.tsx b/frontend/src/components/inputs/ChildBirthdayInput.tsx index af976d5..7314e2c 100644 --- a/frontend/src/components/inputs/ChildBirthdayInput.tsx +++ b/frontend/src/components/inputs/ChildBirthdayInput.tsx @@ -36,7 +36,12 @@ export function ChildBirthdayInput({ return (
- {resolvedLabel} + + {resolvedLabel} +