Skip to content

Commit e6bafd6

Browse files
authored
fix: dashed line for incomplete relationships COMPASS-10157 (#7647)
1 parent 4c4a8f6 commit e6bafd6

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

packages/compass-data-modeling/src/utils/nodes-and-edges.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,4 +772,25 @@ describe('relationshipToDiagramEdge', function () {
772772
expect(edge.sourceFieldIndex).to.equal(2);
773773
expect(edge.targetFieldIndex).to.equal(1);
774774
});
775+
776+
it('should choose animated for incomplete relationships', function () {
777+
const incompleteEdge = relationshipToDiagramEdge(
778+
{
779+
...relationship,
780+
relationship: [
781+
{
782+
...relationship.relationship[0],
783+
fields: null,
784+
},
785+
relationship.relationship[1],
786+
],
787+
},
788+
false,
789+
[]
790+
);
791+
expect(incompleteEdge.animated).to.equal(true);
792+
793+
const completeEdge = relationshipToDiagramEdge(relationship, false, []);
794+
expect(completeEdge.animated).to.equal(false);
795+
});
775796
});

packages/compass-data-modeling/src/utils/nodes-and-edges.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,5 +245,6 @@ export function relationshipToDiagramEdge(
245245
markerStart: source.cardinality === 1 ? 'one' : 'many',
246246
markerEnd: target.cardinality === 1 ? 'one' : 'many',
247247
selected,
248+
animated: !isRelationshipValid(relationship),
248249
};
249250
}

0 commit comments

Comments
 (0)