1
0

feat: Header 倒计时数字滚动动画 — @number-flow/react 替换静态文本

This commit is contained in:
2026-05-16 00:14:35 +08:00
parent 88f4119a4e
commit f8d563c668
9 changed files with 212 additions and 41 deletions

View File

@@ -88,3 +88,23 @@ Object.defineProperty(dom.window, "matchMedia", {
dom.window.Element.prototype.scrollTo = () => {};
dom.window.Element.prototype.scrollIntoView = () => {};
Object.defineProperty(dom.window, "customElements", {
value: {
define: () => {},
get: () => undefined,
},
writable: true,
});
globalThis.customElements = dom.window.customElements;
// Mock @number-flow/react globally (custom elements not supported in jsdom)
import { mock } from "bun:test";
import { createElement } from "react";
void mock.module("@number-flow/react", () => {
const NumberFlow = () => createElement("span", { "data-testid": "number-flow" });
const NumberFlowGroup = ({ children }: { children: unknown }) => children;
return { default: NumberFlow, NumberFlowGroup };
});