feat: Header 倒计时数字滚动动画 — @number-flow/react 替换静态文本
This commit is contained in:
@@ -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 };
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user