diff --git a/lib/features/auto-place/AutoPlaceUtil.spec.ts b/lib/features/auto-place/AutoPlaceUtil.spec.ts new file mode 100644 index 000000000..7a720c4bf --- /dev/null +++ b/lib/features/auto-place/AutoPlaceUtil.spec.ts @@ -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'); + +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' +}); \ No newline at end of file