mirror of
https://github.com/gramps-project/gramps-web.git
synced 2026-10-18 14:27:27 +08:00
7a8082ecab
* Draw each person once in the relationship chart People who share a family as partners, directly or through other partners, form one Graphviz node: a row of cards in family list order with the family markers in the gaps between them. This replaces the couple clusters, the placeholder parents and the copies of people with several families. Partners who are not adjacent are joined by a bracket below the row, and a child in the same row as their parents is linked by an arch over it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Address comment * Link a child once from a single parent of several families When several parent families of a child resolve to the same single fetched parent, they give one link instead of identical links with the same key. It is Birth if the child is the parent's birth child in any of the families. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
1.0 KiB
JavaScript
27 lines
1.0 KiB
JavaScript
import {describe, it, expect, vi} from 'vitest'
|
|
import {Graphviz} from '@hpcc-js/wasm'
|
|
import {FamilyGraph} from '../../src/charts/model/FamilyGraph.js'
|
|
import {layoutRelationships} from '../../src/charts/layout/relationshipLayout.js'
|
|
|
|
vi.mock('@hpcc-js/wasm', () => ({Graphviz: {load: vi.fn()}}))
|
|
|
|
// X is the only person, so the layout has a single node
|
|
const graph = new FamilyGraph([{handle: 'X', gramps_id: 'I_X'}])
|
|
const output = {
|
|
bb: '0,0,20,10',
|
|
objects: [{name: 'group0', pos: '10,5'}],
|
|
edges: [],
|
|
}
|
|
|
|
describe('layoutRelationships loading Graphviz', () => {
|
|
it('loads Graphviz again after a failed load', async () => {
|
|
Graphviz.load
|
|
.mockRejectedValueOnce(new Error('offline'))
|
|
.mockResolvedValueOnce({layout: () => JSON.stringify(output)})
|
|
await expect(layoutRelationships(graph, 'X')).rejects.toThrow('offline')
|
|
const layout = await layoutRelationships(graph, 'X')
|
|
expect(layout.root).toMatchObject({handle: 'X', x: 0, y: 0})
|
|
expect(Graphviz.load).toHaveBeenCalledTimes(2)
|
|
})
|
|
})
|