From 6a73be3e49abae7e794d6762badf0231cd7fabfe Mon Sep 17 00:00:00 2001 From: Mischa Date: Tue, 7 Jul 2026 08:35:41 +0200 Subject: [PATCH] test(trip): tighten description-clamp assertion + correct R11 coverage note MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - trip-header.spec.js: replace the vacuous `toContainText('finally made sense')` (the tail text is in the DOM even while collapsed) with real clamp/un-clamp assertions — clientHeight < scrollHeight when collapsed, clientHeight >= scrollHeight once expanded — so the test actually proves the toggle changes visibility. - trips-list.spec.js: the header comment claimed R11 coverage no fixture provided. Note that R11 (set-but-unresolvable cover_image) shares the exact else-branch the R7/AE3 fallback test exercises, so it's covered by construction in the shared cover macro. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01RDS6t8wcpbwKvvrxykVQ5K --- tests/ui/trip/trip-header.spec.js | 10 +++++++++- tests/ui/trip/trips-list.spec.js | 5 ++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/ui/trip/trip-header.spec.js b/tests/ui/trip/trip-header.spec.js index 2f25ca8..047bc0c 100644 --- a/tests/ui/trip/trip-header.spec.js +++ b/tests/ui/trip/trip-header.spec.js @@ -36,6 +36,11 @@ test('U4/R13: description is clamped to a preview and expands to full text', asy await expect(desc).toHaveAttribute('data-collapsed', 'true'); await expect(btn).toBeVisible(); + // Collapsed: the body is genuinely clamped — visible height is shorter than + // its full content (the max-height:4.8em preview actually hides overflow). + const clampedWhenCollapsed = await body.evaluate((el) => el.clientHeight < el.scrollHeight); + expect(clampedWhenCollapsed).toBe(true); + const collapsedH = (await body.boundingBox()).height; await btn.click(); @@ -43,7 +48,10 @@ test('U4/R13: description is clamped to a preview and expands to full text', asy await expect(btn).toHaveText('Show less'); const expandedH = (await body.boundingBox()).height; expect(expandedH).toBeGreaterThan(collapsedH); - await expect(body).toContainText('finally made sense'); // tail of the full description + // Expanded: the clamp is gone — the full text is now actually visible, not + // merely present in the DOM (which it was even while collapsed). + const unclampedWhenExpanded = await body.evaluate((el) => el.clientHeight >= el.scrollHeight - 1); + expect(unclampedWhenExpanded).toBe(true); }); // ── R9/AE3: banner uses the first journal image (no cover_image set) ─────────── diff --git a/tests/ui/trip/trips-list.spec.js b/tests/ui/trip/trips-list.spec.js index 83cd161..1d72518 100644 --- a/tests/ui/trip/trips-list.spec.js +++ b/tests/ui/trip/trips-list.spec.js @@ -1,5 +1,8 @@ // @ts-check -// Tests: U3 — trip-list card one-liner + retina cover (R5, R6, R7, R11, R14) +// Tests: U3 — trip-list card one-liner + retina cover (R5, R6, R7, R14) +// R11 (set-but-unresolvable cover_image falls back) shares the exact else-branch +// exercised by the R7/AE3 fallback test below; it is covered by construction in +// the shared cover macro rather than by a dedicated fixture here. const { test, expect } = require('@playwright/test'); const DEMO_HREF = '/trips/italy-2026-demo'; // has a tagline, no cover_image (entry-image fallback)