import { describe, expect, it } from 'vitest'; import { resizeCropExpandFrame } from './ImageCanvasCropExpandModel'; describe('ImageCanvasCropExpandModel', () => { it('resizes crop-expand frame freely from canvas handles', () => { expect( resizeCropExpandFrame({ frame: { x: 100, y: 80, width: 200, height: 120 }, handle: 'right', deltaX: 40, deltaY: 0, ratio: 'free', }), ).toEqual({ x: 100, y: 80, width: 240, height: 120 }); }); it('keeps a fixed ratio while dragging a crop-expand handle', () => { const frame = resizeCropExpandFrame({ frame: { x: 100, y: 80, width: 200, height: 120 }, handle: 'bottom-right', deltaX: 80, deltaY: 10, ratio: '1:1', }); expect(frame.width).toBe(frame.height); expect(frame).toEqual({ x: 100, y: 80, width: 280, height: 280 }); }); });