Files
seaislee1209 caec48c827 fix(asset-factory): 图片工具卡内容贴左 — 盖掉残留全局 .factory-body 漏进的居中
旧全局 .factory-body(styles.css)是老两栏 grid 带 align-items:center;新的
.asset-factory .factory-body 特异性更高但没写 align-items,导致 center 漏进来把
标签/标题/按钮整块水平居中。卡越宽偏越多(2列卡内容离左边 ~167px)。
显式补 align-items:stretch 盖掉 → 内容左对齐贴 30px 内边距(无头实测 31px,不随卡宽漂移)。
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-21 21:26:28 +08:00

20 lines
1.2 KiB
JavaScript

import { chromium } from "playwright";
const b=await chromium.launch({headless:true});
async function measure(w){
const ctx=await b.newContext({viewport:{width:w,height:900}});
const p=await ctx.newPage();
await p.goto("http://localhost:5200/login"); await p.waitForTimeout(300);
await p.fill("#auth-username","airshelf"); await p.fill("#auth-pwd","Restraint2026");
await p.click("button.btn-cta"); await p.waitForFunction(()=>!location.pathname.startsWith("/login"),{timeout:12000});
await p.goto("http://localhost:5200/asset-factory"); await p.waitForTimeout(1500);
const card=await p.locator(".factory-card").first().boundingBox();
const tag=await p.locator(".factory-card").first().locator(".factory-tag").boundingBox();
const title=await p.locator(".factory-card").first().locator(".factory-title").boundingBox();
if(w===1200) await p.locator(".factory-card").first().screenshot({path:"../../../_qa_shots/factory-fixed.png"});
await ctx.close();
return {viewport:w, cardW:Math.round(card.width), tag_offset:Math.round(tag.x-card.x), title_offset:Math.round(title.x-card.x)};
}
console.log(JSON.stringify(await measure(1440)));
console.log(JSON.stringify(await measure(1200)));
await b.close();