import { describe, expect, it } from 'vitest'; import { computeDropZone } from './tabDnd'; describe('computeDropZone', () => { const W = 400; const H = 200; it('returns center for the middle region', () => { expect(computeDropZone(W / 2, H / 2, W, H)).toBe('center'); }); it('picks the nearest edge when within the edge band', () => { expect(computeDropZone(10, H / 2, W, H)).toBe('left'); expect(computeDropZone(W - 10, H / 2, W, H)).toBe('right'); expect(computeDropZone(W / 2, 10, W, H)).toBe('top'); expect(computeDropZone(W / 2, H - 10, W, H)).toBe('bottom'); }); it('a corner resolves to its nearest edge', () => { // Top-left corner: x frac 0.025 < y frac 0.05 -> left wins. expect(computeDropZone(10, 10, W, H)).toBe('left'); }); it('falls back to center for a zero-sized rect', () => { expect(computeDropZone(0, 0, 0, 0)).toBe('center'); }); });