feat(라이브): 달력 보기 세로 2분할과 전체 너비

날짜로 이동 줄을 없애고 달력을 화면 오른쪽 위에 고정한다.
라이브 커머스 화면은 공용 최대 폭(1550px)을 풀고 안쪽 여백을 16px 로 줄여 화면 전체 너비를 쓴다.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-05 18:55:54 +09:00
parent db32d03e07
commit 97b9729671
10 changed files with 51 additions and 42 deletions
+29 -5
View File
@@ -1,7 +1,7 @@
// 라이브 커머스 오른쪽 달력(2026-11-05) — 실제 브라우저(Chromium).
// python tests/js/render_live.py
// NODE_PATH=<playwright 경로> PJ_TEST_BROWSER=<Chrome 경로> node tests/js/live_calendar.browser.test.js
// 표 오른쪽에 달력, 말레이시아 공휴일·대체휴일 빨강·이름·말풍선, 날짜를 누르면 그 날이 표 맨 왼쪽(마지막 날까지), 다른 달은 그 달 화면으로 가서 맨 왼쪽, 영문 화면은 달력도 영어.
// 세로 2분할·오른쪽 위 고정·전체 너비, 말레이시아 공휴일·대체휴일 빨강·이름·말풍선, 날짜를 누르면 그 날이 표 맨 왼쪽(마지막 날까지), 다른 달은 그 달 화면으로 가서 맨 왼쪽, 영문 화면은 달력도 영어.
const fs = require("fs"), path = require("path");
const { chromium } = require("playwright");
const ROOT = path.join(__dirname, "..", "..");
@@ -42,7 +42,34 @@ function check(name, cond, extra) {
await p.goto("http://erp.test/live/calendar?month=2026-11");
await p.waitForTimeout(300);
const side = await p.locator("#lv-side-cal").boundingBox(), wrap = await p.locator("#lv-cal-wrap").boundingBox();
check("달력이 표 오른쪽", side.x >= wrap.x + wrap.width && Math.abs(side.y - wrap.y) < 2, { side: side, wrap: wrap });
const bar = await p.locator(".lv-bar").boundingBox();
check("달력이 오른쪽 위(왼쪽 내용과 같은 높이에서 시작)", side.x >= wrap.x + wrap.width && Math.abs(side.y - bar.y) < 6, { side: side, bar: bar });
check("날짜로 이동 줄 없음", (await p.locator(".lv-jump, [data-jump]").count()) === 0);
const edges = await p.evaluate(function () {
const page = document.querySelector(".erp-page").getBoundingClientRect();
const s = document.getElementById("lv-side-cal").getBoundingClientRect(), l = document.querySelector(".lv").getBoundingClientRect();
return { left: l.left - page.left, right: page.right - s.right };
});
check("좌우 여백 16px", edges.left <= 17 && edges.right <= 34, edges); // 오른쪽 = 여백 + 스크롤 막대
await p.setViewportSize({ width: 2400, height: 900 });
await p.waitForTimeout(100);
const wide = await p.evaluate(function () {
const page = document.querySelector(".erp-page").getBoundingClientRect();
return { pageRight: page.right, shell: document.documentElement.clientWidth };
});
check("넓은 화면도 전체 너비(최대 폭 해제)", Math.abs(wide.pageRight - wide.shell) < 2, wide);
await p.setViewportSize({ width: 1600, height: 500 });
await p.waitForTimeout(100);
await p.evaluate(function () { document.querySelector(".erp-page").scrollTop = 200; });
await p.waitForTimeout(100);
const scrolled = await p.evaluate(function () {
const pg = document.querySelector(".erp-page");
return { moved: pg.scrollTop, top: document.getElementById("lv-side-cal").getBoundingClientRect().top - pg.getBoundingClientRect().top };
});
check("스크롤해도 달력이 위에 고정", scrolled.moved > 0 && Math.abs(scrolled.top - 16) < 2, scrolled);
await p.evaluate(function () { document.querySelector(".erp-page").scrollTop = 0; });
await p.setViewportSize({ width: 1600, height: 900 });
await p.waitForTimeout(100);
check("디파발리 = 빨강·이름·말풍선", (await day("2026-11-08").getAttribute("class")).includes("has-hol") && (await day("2026-11-08").getAttribute("title")) === "디파발리");
check("대체휴일 표시", (await day("2026-11-09").innerText()).includes("대체휴일") && (await day("2026-11-09").getAttribute("title")) === "디파발리 대체", await day("2026-11-09").innerText());
await p.screenshot({ path: path.join(__dirname, ".out", "live_side_cal.png") });
@@ -58,9 +85,6 @@ function check(name, cond, extra) {
await day("2026-11-02").click();
await p.waitForTimeout(150);
check("앞날로 돌아감", (await gap("2026-11-02")) < 2, await gap("2026-11-02"));
await p.locator('.lv-jump-day[data-jump="2026-11-20"]').click();
await p.waitForTimeout(150);
check("날짜로 이동 줄도 맨 왼쪽·달력 선택 따라감", (await gap("2026-11-20")) < 2 && (await day("2026-11-20").getAttribute("class")).includes("is-selected"));
await p.locator('#lv-side-cal [data-nav="1"]').click();
await Promise.all([p.waitForURL(/month=2026-12/), day("2026-12-10").click()]);
+1 -1
View File
@@ -511,7 +511,7 @@ def body(c):
# ── 달력: 카드 머리 = Tiktok Handle, Fee, 옮기기(길이 유지)·맞바꾸기, 광고비·ROAS, 권한 ──
c.post("/live/broadcasts", data={**show, "id": bid, "sales_amount": "48", "start_time": "12:00", "end_time": "14:00", "broadcast_date": "2031-03-05"})
cal = c.get("/live/calendar?month=2031-03").text
assert "날짜로 이동" in cal and "토요일" in cal and "12:00 - 14:00" in cal and "2시간 (기본 RM50)" in cal
assert "날짜로 이동" not in cal and "토요일" in cal and "12:00 - 14:00" in cal and "2시간 (기본 RM50)" in cal
assert '<span class="lv-card-name">S%s<small>@siti.%s</small></span>' % (tag, tag) in cal and "RM54.80" in cal and ">4.80</b>" in cal
# ── 영문: 화면 세 개 모두 한글 없음(입력한 데이터 제외)·날짜·오류·권한 문구 ──