// @vitest-environment jsdom import { describe, expect, it, vi } from 'vitest'; import { render } from '@testing-library/react'; import { fireEvent } from '@testing-library/dom'; import { ShapePathFormulasKeys, type PPTShapeElement } from '@openmaic/dsl'; import type { EditIntent } from '../../src/react/types'; import { useShapeKeypointGesture } from '../../src/react/useShapeKeypointGesture'; const shape: PPTShapeElement = { id: 'shape-1', type: 'shape', left: 100, top: 100, width: 200, height: 100, rotate: 0, viewBox: [200, 100], path: 'old', pathFormula: ShapePathFormulasKeys.ROUND_RECT, keypoints: [0.25], fill: '#fff', fixedRatio: false, }; const formulas = { [ShapePathFormulasKeys.ROUND_RECT]: { editable: true, range: [[0, 0.5]] as const, relative: ['left'] as const, getBaseSize: [(width: number, height: number) => Math.min(width, height)], formula: (width: number, height: number, values?: readonly number[]) => `M ${width} ${height} ${values?.[0]}`, }, }; function Harness({ onElementsChange }: { onElementsChange: (intents: EditIntent[]) => void }) { const { shapeKeypointDrag, onShapeKeypointPointerDown } = useShapeKeypointGesture({ scale: 2, shapePathFormulas: formulas, onElementsChange, }); return ( <>