fix(ui,a11y): 修 logo 深色模式不可见 + 补 tailwind font-calligraphy 工具类
修复 A:header logo 深色模式字被吞 - logo.svg 右侧公司名(睿新致遠 + NOVALON)硬编码 fill='#0A0E14', 深色背景下 background 同色不可见,红色印章下书法字与英文全部被吞。 - 复用既有 logo-white.svg(白字 + 红印章)作为深色版, header 渲染双 <Image>,按 html[data-theme] CSS 显隐。 - 双 Image 不占位(display:none),零 JS 闪烁,未来主题切换器自动生效。 修复 B:font-calligraphy 工具类不生成 - tailwind.config.js 的 fontFamily 此前未声明 calligraphy key, 导致 font-calligraphy utility 永不生成,4 处装饰书法字 (BrandStamp「值得信赖」/ ChallengeSection「使命」/ WhyUsSection「睿」「我们」) 静默回退 sans。 - fontFamily 加 calligraphy: ['var(--font-calligraphy-system)']。 审计脚本: - logo-compare*.mjs:生产 vs 本地 logo 对比定位 - logo-dark-verify.mjs:明暗双版渲染验证 - font-calligraphy-verify.mjs:合成探针验证 utility 生效 验证: - type-check 0 error · lint 0 error(127 warnings 既有项与本次无关) - 深浅色 header 截图:明暗版正确切换,书法字 + NOVALON 清晰可见 - font-calligraphy 合成探针 computed fontFamily = STKaiti, KaiTi, 楷体, SimKai, serif ✓
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// 终极:直接构造一个含 font-calligraphy className 的测试元素,
|
||||
// 把它注入到任意真实页面 DOM,读取 computed fontFamily —— 验证 CSS 规则真生效
|
||||
import { chromium } from 'playwright';
|
||||
const browser = await chromium.launch();
|
||||
const page = await browser.newPage({ viewport: { width: 1280, height: 800 } });
|
||||
await page.goto('http://127.0.0.1:3000/', { waitUntil: 'networkidle' });
|
||||
await page.waitForTimeout(2000);
|
||||
|
||||
const result = await page.evaluate(() => {
|
||||
// 找一个已渲染的根节点挂测试元素
|
||||
const mount = document.body;
|
||||
const probe = document.createElement('span');
|
||||
probe.id = '__probe_font_calligraphy__';
|
||||
probe.className = 'font-calligraphy';
|
||||
probe.textContent = '使命';
|
||||
probe.style.position = 'fixed';
|
||||
probe.style.top = '-9999px';
|
||||
mount.appendChild(probe);
|
||||
const cs = getComputedStyle(probe);
|
||||
const out = {
|
||||
probeFontFamily: cs.fontFamily,
|
||||
probeClassList: Array.from(probe.classList),
|
||||
};
|
||||
probe.remove();
|
||||
return out;
|
||||
});
|
||||
|
||||
await browser.close();
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
|
||||
const expectedPrefix = 'STKaiti';
|
||||
const pass = result.probeFontFamily.startsWith(expectedPrefix);
|
||||
console.log(`\n[assert] probe computed fontFamily starts with ${expectedPrefix}: ${pass}`);
|
||||
console.log(`[result] ${pass ? 'PASS' : 'FAIL'}`);
|
||||
Reference in New Issue
Block a user