feat(라이브): 달력 카드 이미지 링크에 마우스를 올리면 오른쪽 달력 아래에 미리보기
- 오른쪽 줄을 달력 + 미리보기(.lv-side)로, 첫 장·호스트·날짜·시간 표시, 벗어나면 숨김 - 키보드 탭으로 가도 표시, 좁은 화면은 미리보기 없음(링크는 그대로 새 탭) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,6 +26,9 @@ function check(name, cond, extra) {
|
||||
const type = f.endsWith(".css") ? "text/css" : f.endsWith(".js") ? "application/javascript" : "font/woff2";
|
||||
return r.fulfill({ status: 200, contentType: type, body: fs.readFileSync(f) });
|
||||
}
|
||||
if (u.pathname.startsWith("/live/images/")) { // 결과 이미지 미리보기 — 아무 그림이나
|
||||
return r.fulfill({ status: 200, contentType: "image/png", body: fs.readFileSync(path.join(ROOT, "app", "static", "dispatch", "courier", "tiktok.png")) });
|
||||
}
|
||||
const page = u.pathname === "/live/calendar" ? (u.searchParams.get("month") === "2026-12" ? "live_cal_dec.html" : "live_cal_ko.html") : u.pathname.slice(1);
|
||||
if (!page.endsWith(".html")) return r.fulfill({ status: 200, contentType: "application/json", body: "{}" });
|
||||
r.fulfill({ status: 200, contentType: "text/html; charset=utf-8", body: fs.readFileSync(path.join(__dirname, ".out", page), "utf8") });
|
||||
@@ -127,6 +130,22 @@ function check(name, cond, extra) {
|
||||
});
|
||||
check("합친 칸 높이 = 두 줄", tall < 2, tall);
|
||||
await p.screenshot({ path: path.join(__dirname, ".out", "live_merge.png") });
|
||||
// 이미지 링크에 마우스 → 오른쪽 달력 아래 미리보기, 벗어나면 숨김
|
||||
const imgLink = p.locator('td[data-day="2026-11-05"][data-start="06:00"] a[data-preview]');
|
||||
check("미리보기 처음엔 숨김", await p.locator("#lv-preview").isHidden());
|
||||
await imgLink.hover();
|
||||
await p.waitForTimeout(200);
|
||||
const pv = await p.evaluate(function () {
|
||||
const box = document.getElementById("lv-preview"), cal = document.getElementById("lv-side-cal").getBoundingClientRect(), b = box.getBoundingClientRect();
|
||||
const img = box.querySelector("img");
|
||||
return { hidden: box.hidden, src: img.getAttribute("src"), loaded: img.naturalWidth > 0, cap: box.querySelector("figcaption").textContent,
|
||||
below: b.top >= cal.bottom, sameCol: Math.abs(b.left - cal.left) < 2 && Math.abs(b.width - cal.width) < 2, bottom: b.bottom <= window.innerHeight };
|
||||
});
|
||||
check("이미지 링크에 마우스 = 달력 아래 미리보기", !pv.hidden && pv.src === "/live/images/7" && pv.loaded && pv.below && pv.sameCol && pv.bottom && pv.cap.includes("1/2"), pv);
|
||||
await p.screenshot({ path: path.join(__dirname, ".out", "live_preview.png") });
|
||||
await p.mouse.move(5, 5);
|
||||
await p.waitForTimeout(100);
|
||||
check("벗어나면 숨김", await p.locator("#lv-preview").isHidden());
|
||||
|
||||
await p.locator('#lv-side-cal [data-nav="1"]').click();
|
||||
await Promise.all([p.waitForURL(/month=2026-12/), day("2026-12-10").click()]);
|
||||
|
||||
Reference in New Issue
Block a user