From e3a95b7b23aefe184ef9abc672a23344f0d831a8 Mon Sep 17 00:00:00 2001 From: priyanshuANDcoad Date: Sun, 9 Aug 2026 00:52:57 +0530 Subject: [PATCH] test(web): fix right-edge overflow test to actually trigger right clamping --- web/src/lib/utils/people-utils.spec.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/web/src/lib/utils/people-utils.spec.ts b/web/src/lib/utils/people-utils.spec.ts index 8e95e69fa3..5d5cc8b80d 100644 --- a/web/src/lib/utils/people-utils.spec.ts +++ b/web/src/lib/utils/people-utils.spec.ts @@ -85,10 +85,12 @@ describe('getRelativeFaceLabelLeft', () => { }); it('should clamp right edge when label overflows container right boundary', () => { - // box: left 950, width 40; label: width 200; overlay: 1000 - // preferred absolute X = 950 + 40 - 200 = 790 - // clamped absolute X = min(790, 800) = 790 - expect(getRelativeFaceLabelLeft(950, 40, 200, 1000)).toBe(-160); + // box: left 950, width 100; label: width 80; overlay: 1000 + // preferred absolute X = 950 + 100 - 80 = 970 + // max allowed X = 1000 - 80 = 920 + // clamped absolute X = 920 + // localLeft = 920 - 950 = -30 + expect(getRelativeFaceLabelLeft(950, 100, 80, 1000)).toBe(-30); }); it('should handle boundary case when label exactly fits inside face box', () => {