From 198f6f2d3bed7ef0c532cb79ac5ce9b643d3bbd5 Mon Sep 17 00:00:00 2001 From: "bert.hausmans" Date: Sat, 25 Apr 2026 03:37:09 +0200 Subject: [PATCH] fix(portal): align FieldSectionPriority spec with WS-5b max_selected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pre-existing breakage on main since WS-5b's validation_rules canonicalisation renamed max_priorities → max_selected. Component was migrated; the spec fixtures were not. Four occurrences in apps/portal/tests/components/public-form/FieldSectionPriority.spec.ts: - line 182, 253, 260: max_priorities used in fixture, the component's max_selected read returned undefined → test assertions on rendered max-cap behaviour failed (2 tests red) - line 220: also used max_priorities; test was accidentally passing because the value (99) was ignored and the component fell back to HARD_CAP = 5 which happened to match the "5 / 5" assertion. Now passes via the correct path (99 clamped to HARD_CAP via Math.min). No component-side changes. No new test helpers. Pure fixture key-rename matching ARCH-CONSOLIDATION-ADDENDUM-2026-04-24 WS-5b Uitvoering: "max_priorities → rule_type = max_selected: semantically equivalent; two enum cases for one semantic = rot." Pre: 111/113 passing, 2 failing. Post: 113/113 passing. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../components/public-form/FieldSectionPriority.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/portal/tests/components/public-form/FieldSectionPriority.spec.ts b/apps/portal/tests/components/public-form/FieldSectionPriority.spec.ts index 2efeccc5..0a35c812 100644 --- a/apps/portal/tests/components/public-form/FieldSectionPriority.spec.ts +++ b/apps/portal/tests/components/public-form/FieldSectionPriority.spec.ts @@ -179,7 +179,7 @@ describe('FieldSectionPriority', () => { it('respects validation_rules.max_priorities when present', async () => { state.data.value = [section({ id: 'a' }), section({ id: 'b' })] const w = mountPicker({ - field: field({ validation_rules: { max_priorities: 1 } }), + field: field({ validation_rules: { max_selected: 1 } }), modelValue: [{ section_id: 'a', priority: 1 }], }) @@ -217,7 +217,7 @@ describe('FieldSectionPriority', () => { { section_id: 'e', priority: 5 }, ] const w = mountPicker({ - field: field({ validation_rules: { max_priorities: 99 } as Record }), + field: field({ validation_rules: { max_selected: 99 } as Record }), modelValue: ranked, }) @@ -250,14 +250,14 @@ describe('FieldSectionPriority', () => { // Not at cap — unranked cards must not carry the disabled marker. const notFull = mountPicker({ - field: field({ validation_rules: { max_priorities: 3 } }), + field: field({ validation_rules: { max_selected: 3 } }), modelValue: [{ section_id: 'a', priority: 1 }], }) expect(notFull.html()).not.toContain('section-priority-unranked-disabled') // Hit the cap — remaining unranked cards switch to the disabled class. const full = mountPicker({ - field: field({ validation_rules: { max_priorities: 1 } }), + field: field({ validation_rules: { max_selected: 1 } }), modelValue: [{ section_id: 'a', priority: 1 }], }) expect(full.html()).toContain('section-priority-unranked-disabled')