Merged PR 2256: refactor(representations): preserve Welsh conditional validation and summary...

refactor(representations): preserve Welsh conditional validation and summary parity

Related work items: #22441
This commit is contained in:
Robert Bond
2026-04-17 12:44:23 +00:00
parent 33f31ad3c8
commit 7713fc3724
8 changed files with 949 additions and 899 deletions
+93 -2
View File
@@ -6,8 +6,8 @@ Base branch: `refactor`
## Status
Current slice: Slice R6Async Data / Service Layer Cleanup
Status: COMPLETE
Current slice: Slice R7Summary / Case-Type Rendering Simplification
Status: IMPLEMENTED (manual validation in progress)
---
@@ -214,6 +214,97 @@ Reduce duplication in summary-type components.
- unify repeated rendering patterns
- introduce shared summary renderer where safe
**Completion notes (this slice):**
- Implemented on feature branch created from `refactor`: `rep-slice-r7-summary-rendering-simplification`.
- Added render-only summary primitives:
- `components/case/summary/components/SummaryCard.js`
- `components/case/summary/components/SummaryRow.js`
- Applied these primitives to a small proof subset of summary-type files only:
- `components/case/summaryTypes/pinswg_planningappeals78id.js`
- `components/case/summaryTypes/pinswg_planningconditionss73s79id.js`
- Preserved Slice R7 constraints:
- no CaseSummary orchestration changes
- no translation/date/bilingual logic moved into shared primitives
- no linked-cases extraction (kept inline)
- no row/card order changes intended
- no route/query/payload/Redux/business-rule changes
- Validation evidence:
- `npm run lint` completed (warnings only, no new errors).
- `npm run test:reps` completed: **7 passed**.
- Manual APP/IP/Agent/LPA and EN/CY checks: **in progress** (Welsh IP statement option-label parity issue detected and patched in representation flow check display).
---
### Post-R7 follow-up patch — Welsh IP statement label parity
**Issue observed during manual check:**
- In Welsh journey (Interested Party → Statement), option-label parity regressed:
- selection step showed duplicated Welsh “No” labels
- check/submit summary displayed raw English `No`
**Fix applied (minimal, behaviour-preserving):**
- `components/case/representation/representationInterestedPartyPerson.js`
- restored canonical option values for conditional radio to `options={["Yes", "No"]}` so `RenderCondtionalRadioList` translation mapping behaves correctly.
- `components/case/representation/representationCompleteSubmit.js`
- added display mapping for `representationOnBehalfOf` summary value:
- `Yes``t("myrepresentations:questionnaire-yes")`
- `No``t("myrepresentations:questionnaire-no")`
- fallback unchanged for non-boolean/unexpected values
**Validation evidence (follow-up patch):**
- `npm run lint` completed (warnings only, no new errors).
- `npm run test:reps` completed: **7 passed (4.6m)**.
- Manual Welsh IP statement check: input labels and check-summary label now aligned via translation mapping.
---
### Post-R7 follow-up patch 2 — Welsh IP conditional details submit validation
**Issue observed during manual check:**
- In Welsh journey (Interested Party → Statement), when selecting “Yes” and entering conditional details, submit could still block with required validation on the conditional text field.
**Fix applied (minimal, behaviour-preserving):**
- `components/case/representation/representationElements.js`
- In `RenderCondtionalRadioList`, made “Yes selected” detection bilingual-safe and value-safe:
- accepts canonical value (`"Yes"`), translated display value (`t("myrepresentations:questionnaire-yes")`), and boolean `true`.
- Replaced unconditional conditional-field validator with context-aware validator:
- `requiredIfYes` only enforces required when “Yes” is selected.
- Updated conditional rendering check to use the same normalized `isYesSelected` guard.
**Validation evidence (follow-up patch 2):**
- `npm run lint` completed (warnings only, no new errors).
- `npm run test:reps` run completed with **6 passed / 1 failed**.
- Failure: `[chromium] Raise representation as an Appellant` timed out waiting for `dd a.govuk-link--no-underline` (entry-link locator timeout), not in Welsh IP conditional details path.
---
### Post-R7 follow-up patch 3 — Welsh conditional required check tied to current radio value
**Issue observed during manual check:**
- In Welsh journey, selecting “Yes” could still leave the conditional details field blocked with required validation (`Yn ofynnol`) after entering text, preventing progress.
**Fix applied (minimal, behaviour-preserving):**
- `components/case/representation/representationElements.js`
- Added explicit `normalizeYesNo(...)` mapping for both selected value and option values:
- canonical/translated/boolean values normalize to `"Yes"` / `"No"`.
- Radio `Field` values now use normalized canonical values (preserves existing payload expectation).
- Updated conditional `requiredIfYes` validator to evaluate against the **current form value** (`allValues[id]`) rather than closure-only value.
- Required check now trims whitespace and only errors when selected value resolves to `"Yes"` and details are empty.
**Validation evidence (follow-up patch 3):**
- `npm run lint` completed (warnings only, no new errors).
- `npm run test:reps` intentionally **not run** per user instruction while manual Welsh verification is in progress.
---
### Slice R8 — Submission / Finalisation Boundary Isolation