fix(portal): align FieldSectionPriority spec with WS-5b max_selected
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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<string, unknown> }),
|
||||
field: field({ validation_rules: { max_selected: 99 } as Record<string, unknown> }),
|
||||
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')
|
||||
|
||||
Reference in New Issue
Block a user