feat(brand): 首页影像版式与名+号字标;修复站内跳转白屏 #32

Merged
zhangxiang merged 12 commits from feat/brand-wordmark-landing into dev 2026-10-20 22:14:20 +08:00
Showing only changes of commit 3f11d7ee22 - Show all commits
+13 -5
View File
@@ -696,14 +696,22 @@ test.describe("无障碍性 - A11y 基础检查", { tag: "@regression" }, () =>
const images = page.locator("img");
const count = await images.count();
let imagesWithoutAlt = 0;
// 2026-10-20:旧判据把 `alt=""` 也计成「没有 alt」,再用「允许 2 张」兜底。
// 但 `alt=""` 正是装饰图的正确写法,于是这条用例一边误报装饰图、一边给真正
// 漏标的 <img> 留了 2 张额度。现只盯漏标那一维:既无 alt 属性、又未用
// aria-hidden/role 声明装饰性的图片一律判红,额度 0。「信息图的 alt 是否语义正确」
// 机械上判不出来,由全站 axe 节点计数(npm run check:axe)承担。
let informativeWithoutAlt = 0;
for (let i = 0; i < count; i++) {
const alt = await images.nth(i).getAttribute("alt");
if (!alt) imagesWithoutAlt++;
const img = images.nth(i);
const alt = await img.getAttribute("alt");
const hidden = await img.getAttribute("aria-hidden");
const role = await img.getAttribute("role");
const decorative = hidden === "true" || role === "presentation";
if (alt === null && !decorative) informativeWithoutAlt++;
}
// 允许少量装饰性图片没有 alt(使用 alt="" 或 role="presentation")
expect(imagesWithoutAlt).toBeLessThanOrEqual(2);
expect(informativeWithoutAlt).toBe(0);
});
test("Heading 层级结构合理", async ({ page }) => {