CI / check (push) Successful in 32s
CI / tests-unit (push) Successful in 2m12s
CI / tests-integration (push) Successful in 2m43s
CI / tests-ui (push) Successful in 4m22s
CI / tests-imaging-browsers (push) Successful in 2m10s
CI / tests-quality (push) Successful in 1m32s
CI / preflight (push) Skipped
CI / deploy (push) Successful in 3m1s
The homepage mixed four different translucent washes (surface 44-60% plus a backdrop-filter each), rendered the same four counters twice, and showed a dangling "Welcome to " eyebrow because the localized string expected the hotel name. A missing theme wallpaper replaced the whole sky gradient with flat white, and stale CMS image references produced broken images and 404s. Replace the ad-hoc panels with one opaque, theme-derived `.panel` token set (surface, border, shadow, header, radius) and a `.panel-float` variant for the counter strip that straddles the hero edge. The strip is now the single home of the four headline counters; a failed read renders "unavailable" instead of silently dropping a cell. Add the fourth feature card (Games) that already had translated copy, link recent users to their profiles, and fall back to themed placeholders for news covers and camera photos without an upload. Add `pages.home.heroEyebrow` to all 25 locales, layer the CMS wallpaper over `--site-bg-gradient` instead of replacing it, and keep the sky in dark mode. Add `publicAssetExists` so local uploads that no longer exist are skipped (wallpaper, help topics) rather than rendered broken. Fix the `/help` topic icons to use the `/assets/images/help-center/` base the detail page already used. Throttle the spotlight glow to one update per animation frame, drop the dead `.glass-chip` rules, define the missing `.panel-float`, and fix the stat divider and reduced-motion selectors. Stat labels use the readable text token so they clear WCAG AA, and the language button's accessible name now contains its visible label. Verified: tsc, biome, 3590 unit tests, i18n audit unchanged, axe 0 violations at 390/768/1024/1280/1440 in light and dark, quality e2e 16/16.
52 lines
1.7 KiB
TypeScript
52 lines
1.7 KiB
TypeScript
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
import { publicAssetExists } from "./public-asset";
|
|
|
|
describe("publicAssetExists", () => {
|
|
const originalCwd = process.cwd();
|
|
let root: string;
|
|
|
|
beforeAll(() => {
|
|
root = mkdtempSync(join(tmpdir(), "public-asset-"));
|
|
mkdirSync(join(root, "public", "assets"), { recursive: true });
|
|
writeFileSync(join(root, "public", "assets", "present.png"), "");
|
|
process.chdir(root);
|
|
});
|
|
|
|
afterAll(() => {
|
|
process.chdir(originalCwd);
|
|
rmSync(root, { recursive: true, force: true });
|
|
});
|
|
|
|
it("accepts a local file that exists", () => {
|
|
expect(publicAssetExists("/assets/present.png")).toBe(true);
|
|
});
|
|
|
|
it("ignores query strings and hashes", () => {
|
|
expect(publicAssetExists("/assets/present.png?v=2#x")).toBe(true);
|
|
});
|
|
|
|
it("rejects a local file that is missing", () => {
|
|
expect(publicAssetExists("/assets/gone.png")).toBe(false);
|
|
});
|
|
|
|
it("rejects empty input", () => {
|
|
expect(publicAssetExists(null)).toBe(false);
|
|
expect(publicAssetExists(undefined)).toBe(false);
|
|
expect(publicAssetExists("")).toBe(false);
|
|
});
|
|
|
|
it("trusts remote and protocol-relative URLs", () => {
|
|
expect(publicAssetExists("https://cdn.example.com/a.png")).toBe(true);
|
|
expect(publicAssetExists("http://cdn.example.com/a.png")).toBe(true);
|
|
expect(publicAssetExists("//cdn.example.com/a.png")).toBe(true);
|
|
});
|
|
|
|
it("rejects non-http schemes", () => {
|
|
expect(publicAssetExists("javascript:alert(1)")).toBe(false);
|
|
expect(publicAssetExists("data:image/png;base64,AAAA")).toBe(false);
|
|
});
|
|
});
|