Skip to content

Commit

Permalink
test: add AutoPlaceUtil type tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philippfromme authored and nikku committed Jan 16, 2024
1 parent ea1425a commit 7eaa995
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions lib/features/auto-place/AutoPlaceUtil.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import Diagram from '../../Diagram';

import ElementFactory from '../../core/ElementFactory';

import {
findFreePosition,
generateGetNextPosition,
getConnectedDistance
} from './AutoPlaceUtil';

const diagram = new Diagram();

const elementFactory = diagram.get<ElementFactory>('elementFactory');

const source = elementFactory.createShape(),
element = elementFactory.createShape();

const getNextPosition = generateGetNextPosition({ x: 100, y: 100 });

findFreePosition(source, element, { x: 100, y: 100 }, getNextPosition);

getConnectedDistance(source, {
defaultDistance: 100,
direction: 'right',
filter: (connection) => true,
getWeight: (connection) => 1,
maxDistance: 100,
reference: 'center'
});

0 comments on commit 7eaa995

Please sign in to comment.