// nextSize : calcul de la nouvelle taille d'un panneau (delta, inversion, clamp min/max). import { describe, it, expect } from 'vitest'; import { nextSize } from '../src/composables/useSplitter'; describe('useSplitter · nextSize', () => { it('ajoute le delta de position (sens direct)', () => { expect(nextSize(200, 100, 150, { min: 100, max: 400 })).toBe(250); }); it('soustrait le delta quand invert (poignée à droite/bas)', () => { expect(nextSize(200, 100, 150, { min: 100, max: 400, invert: true })).toBe(150); }); it('clampe au maximum', () => { expect(nextSize(380, 100, 200, { min: 100, max: 400 })).toBe(400); }); it('clampe au minimum', () => { expect(nextSize(120, 200, 100, { min: 100, max: 400 })).toBe(100); }); it('taille inchangée si la position ne bouge pas', () => { expect(nextSize(300, 150, 150, { min: 100, max: 400 })).toBe(300); }); });