diff --git a/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte b/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte index 4579e762..b57032b5 100644 --- a/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte +++ b/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte @@ -1,6 +1,6 @@
@@ -67,13 +39,13 @@ function otherName(rel: RelationshipDTO): string { - {chipLabel(rel)} + {chipLabel(rel, personId)} - {otherName(rel)} + {otherName(rel, personId)} {/each} diff --git a/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte.test.ts b/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte.test.ts index b0a13ef6..c23a356e 100644 --- a/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte.test.ts +++ b/frontend/src/routes/persons/[id]/PersonRelationshipsCard.svelte.test.ts @@ -5,6 +5,7 @@ import PersonRelationshipsCard from './PersonRelationshipsCard.svelte'; const PERSON_ID = '00000000-0000-0000-0000-000000000001'; const SPOUSE_ID = '00000000-0000-0000-0000-000000000002'; +const PARENT_ID = '00000000-0000-0000-0000-000000000003'; describe('PersonRelationshipsCard', () => { it('hides an inferred relationship that is already a direct one', async () => { @@ -53,4 +54,42 @@ describe('PersonRelationshipsCard', () => { await expect.element(page.getByText('Carla Cousine')).toBeInTheDocument(); }); + + it('shows Elternteil-von chip when personId is the PARENT_OF subject', async () => { + render(PersonRelationshipsCard, { + personId: PERSON_ID, + relationships: [ + { + id: 'r1', + personId: PERSON_ID, + relatedPersonId: PARENT_ID, + personDisplayName: 'Anna Müller', + relatedPersonDisplayName: 'Kind Müller', + relationType: 'PARENT_OF' + } + ], + inferredRelationships: [] + }); + + await expect.element(page.getByText('Elternteil von')).toBeInTheDocument(); + }); + + it('shows Kind-von chip when personId is the PARENT_OF object', async () => { + render(PersonRelationshipsCard, { + personId: PERSON_ID, + relationships: [ + { + id: 'r2', + personId: PARENT_ID, + relatedPersonId: PERSON_ID, + personDisplayName: 'Eltern Müller', + relatedPersonDisplayName: 'Anna Müller', + relationType: 'PARENT_OF' + } + ], + inferredRelationships: [] + }); + + await expect.element(page.getByText('Kind von')).toBeInTheDocument(); + }); });