refactor: use Node.ELEMENT_NODE replace number (#52163)

* refactor: use Node.ELEMENT_NODE replace number

* fix: fix

* fix: fix

* fix: fix

* Update setup.ts

Signed-off-by: lijianan <574980606@qq.com>

* update

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: afc163 <afc163@gmail.com>
This commit is contained in:
lijianan
2025-09-14 18:02:44 +08:00
committed by GitHub
parent 9daba47ce9
commit 21e88f1f05
2 changed files with 1 additions and 2 deletions

View File

@@ -32,7 +32,7 @@ const Wave: React.FC<WaveProps> = (props) => {
// ============================== Effect ==============================
React.useEffect(() => {
const node = containerRef.current;
if (!node || node.nodeType !== 1 || disabled) {
if (!node || node.nodeType !== window.Node.ELEMENT_NODE || disabled) {
return;
}

View File

@@ -51,7 +51,6 @@ export function fillWindowEnv(window: Window | DOMWindow) {
// https://github.com/yiminghe/css-animation/blob/a5986d73fd7dfce75665337f39b91483d63a4c8c/src/Event.js#L44
win.AnimationEvent = win.AnimationEvent || win.Event;
win.TransitionEvent = win.TransitionEvent || win.Event;
// ref: https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
// ref: https://github.com/jsdom/jsdom/issues/2524
Object.defineProperty(win, 'TextEncoder', { writable: true, value: util.TextEncoder });