施工(HEL-183): 问天工具行右对齐并统一 logo/收起/问师顶距与页头签
恢复顶栏工具行 margin-left:auto,问天隐藏行情条后仍靠右;logo 区与收起按钮对齐顶栏/状态条高度;问师恢复页顶 14px;问天三签改用全站 segmented 页头。 Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Cursor
multica-agent
parent
8a5e78f022
commit
f68f950106
@@ -3735,3 +3735,99 @@ test("desktop header keeps commands in view and tape text unclipped across works
|
||||
await page.screenshot({ path: path.join(shotDir, "admin-390-night.png") });
|
||||
fs.writeFileSync(path.join(shotDir, "measurements.json"), `${JSON.stringify(measurements, null, 2)}\n`);
|
||||
});
|
||||
|
||||
test("HEL-183 heaven tools right-align and shell heights unify", async ({ page }) => {
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const shotDir = path.join(__dirname, "../../runtime/hel183-shots");
|
||||
fs.mkdirSync(shotDir, { recursive: true });
|
||||
await page.setViewportSize({ width: 1440, height: 900 });
|
||||
await mockApplication(page, session("admin", true));
|
||||
await page.goto("/index.html");
|
||||
|
||||
const measure = () => page.evaluate(() => {
|
||||
const box = (node) => {
|
||||
if (!node) return null;
|
||||
const r = node.getBoundingClientRect();
|
||||
return { x: r.x, y: r.y, right: r.right, width: r.width, height: r.height };
|
||||
};
|
||||
const brand = document.querySelector(".module-nav .sidebar-brand") || document.querySelector(".sidebar-brand");
|
||||
const header = document.querySelector(".app-header");
|
||||
const actions = document.querySelector(".header-actions");
|
||||
const collapse = document.querySelector(".sidebar-collapse-button");
|
||||
const status = document.querySelector(".status-bar");
|
||||
const overview = document.querySelector(".overview-strip");
|
||||
const brandBox = box(brand);
|
||||
const headerBox = box(header);
|
||||
const actionsBox = box(actions);
|
||||
const collapseBox = box(collapse);
|
||||
const statusBox = box(status);
|
||||
return {
|
||||
brandHeight: brandBox ? Math.round(brandBox.height) : null,
|
||||
headerHeight: headerBox ? Math.round(headerBox.height) : null,
|
||||
brandBottom: brandBox ? Math.round(brandBox.y + brandBox.height) : null,
|
||||
headerBottom: headerBox ? Math.round(headerBox.y + headerBox.height) : null,
|
||||
collapseHeight: collapseBox ? Math.round(collapseBox.height) : null,
|
||||
statusHeight: statusBox ? Math.round(statusBox.height) : null,
|
||||
actionsNearRight: actionsBox && headerBox ? (headerBox.right - actionsBox.right) < 24 : false,
|
||||
actionsMarginLeft: actions ? getComputedStyle(actions).marginLeft : null,
|
||||
overviewDisplay: overview ? getComputedStyle(overview).display : null,
|
||||
mentorPadTop: (() => {
|
||||
const mentor = document.querySelector("#mentorView");
|
||||
return mentor ? getComputedStyle(mentor).paddingTop : null;
|
||||
})(),
|
||||
};
|
||||
});
|
||||
|
||||
await page.locator('[data-view="sentimentCycleView"]').first().click();
|
||||
await expect(page.locator("#sentimentCycleView")).toHaveClass(/active-view/);
|
||||
let geo = await measure();
|
||||
expect(geo.brandHeight, "logo height").toBe(64);
|
||||
expect(geo.headerHeight, "header height").toBe(64);
|
||||
expect(geo.brandBottom, "logo/header bottom align").toBe(geo.headerBottom);
|
||||
expect(geo.collapseHeight, "collapse height").toBe(28);
|
||||
expect(geo.statusHeight, "status height").toBe(28);
|
||||
expect(geo.actionsNearRight, "sentiment tools right").toBe(true);
|
||||
await page.locator(".app-header").screenshot({ path: path.join(shotDir, "sentiment-header-day.png") });
|
||||
await page.screenshot({ path: path.join(shotDir, "sentiment-page-day.png") });
|
||||
|
||||
await page.locator('[data-view="heavenView"]').first().click();
|
||||
await expect(page.locator("#heavenView")).toHaveClass(/active-view/);
|
||||
await expect(page.locator("#heavenView .heaven-page-head")).toBeVisible();
|
||||
await expect(page.locator("#heavenView .heaven-page-head .segment")).toHaveCount(3);
|
||||
geo = await measure();
|
||||
expect(geo.overviewDisplay, "heaven hides overview").toBe("none");
|
||||
expect(geo.actionsMarginLeft, "tools margin-left resolved").not.toBe("0px");
|
||||
expect(Number.parseFloat(geo.actionsMarginLeft), "tools left auto gap").toBeGreaterThan(40);
|
||||
expect(geo.actionsNearRight, "heaven tools right").toBe(true);
|
||||
expect(geo.brandHeight).toBe(64);
|
||||
expect(geo.collapseHeight).toBe(28);
|
||||
await page.locator(".app-header").screenshot({ path: path.join(shotDir, "heaven-header-day.png") });
|
||||
await page.screenshot({ path: path.join(shotDir, "heaven-page-day.png") });
|
||||
|
||||
await page.locator('[data-heaven-panel="fortune"]').click();
|
||||
await expect(page.locator('[data-heaven-panel="fortune"]')).toHaveClass(/active/);
|
||||
await expect(page.locator("#heavenFortunePanel")).toHaveClass(/active-heaven-panel/);
|
||||
|
||||
await page.locator('[data-view="mentorView"]').first().click();
|
||||
await expect(page.locator("#mentorView")).toHaveClass(/active-view/);
|
||||
geo = await measure();
|
||||
expect(geo.mentorPadTop, "mentor top padding").toBe("14px");
|
||||
await page.screenshot({ path: path.join(shotDir, "mentor-page-day.png") });
|
||||
|
||||
await page.locator("#themeToggle").click();
|
||||
await page.locator('[data-view="heavenView"]').first().click();
|
||||
await expect(page.locator("#heavenView")).toHaveClass(/active-view/);
|
||||
geo = await measure();
|
||||
expect(geo.actionsNearRight, "heaven night tools right").toBe(true);
|
||||
expect(geo.brandHeight).toBe(64);
|
||||
await page.locator(".app-header").screenshot({ path: path.join(shotDir, "heaven-header-night.png") });
|
||||
await page.screenshot({ path: path.join(shotDir, "heaven-page-night.png") });
|
||||
|
||||
await page.locator('[data-view="sentimentCycleView"]').first().click();
|
||||
await page.locator(".app-header").screenshot({ path: path.join(shotDir, "sentiment-header-night.png") });
|
||||
await page.screenshot({ path: path.join(shotDir, "sentiment-page-night.png") });
|
||||
|
||||
await page.locator('[data-view="mentorView"]').first().click();
|
||||
await page.screenshot({ path: path.join(shotDir, "mentor-page-night.png") });
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user