test(trip): tighten description-clamp assertion + correct R11 coverage note

- 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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RDS6t8wcpbwKvvrxykVQ5K
This commit is contained in:
2026-07-07 08:35:41 +02:00
co-authored by Claude Opus 4.8
parent 86f9018f73
commit 6a73be3e49
2 changed files with 13 additions and 2 deletions
+9 -1
View File
@@ -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(desc).toHaveAttribute('data-collapsed', 'true');
await expect(btn).toBeVisible(); 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; const collapsedH = (await body.boundingBox()).height;
await btn.click(); 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'); await expect(btn).toHaveText('Show less');
const expandedH = (await body.boundingBox()).height; const expandedH = (await body.boundingBox()).height;
expect(expandedH).toBeGreaterThan(collapsedH); 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) ─────────── // ── R9/AE3: banner uses the first journal image (no cover_image set) ───────────
+4 -1
View File
@@ -1,5 +1,8 @@
// @ts-check // @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 { test, expect } = require('@playwright/test');
const DEMO_HREF = '/trips/italy-2026-demo'; // has a tagline, no cover_image (entry-image fallback) const DEMO_HREF = '/trips/italy-2026-demo'; // has a tagline, no cover_image (entry-image fallback)