PUGE hai 1 mes
pai
achega
50390ed9cf
Modificáronse 1 ficheiros con 2 adicións e 28 borrados
  1. 2 28
      scripts/378.js

+ 2 - 28
scripts/378.js

@@ -59,21 +59,9 @@ function forceReactUpdate(element, value) {
     const eventSequence = [
         { type: 'focus', isFocus: true },
         { type: 'focusin', isFocus: true },
-        { type: 'click' },
         { type: 'mousedown' },
         { type: 'mouseup' },
-        { type: 'keydown', isKey: true, key: ' ' },
-        { type: 'keypress', isKey: true, key: ' ' },
-        { 
-            type: 'input', 
-            isInput: true, 
-            data: String(value),
-            inputType: 'insertText'
-        },
-        { type: 'keyup', isKey: true, key: ' ' },
-        { type: 'change' },
-        { type: 'blur', isFocus: true },
-        { type: 'focusout', isFocus: true }
+
     ];
     
     eventSequence.forEach((eventConfig, index) => {
@@ -114,7 +102,6 @@ function forceReactUpdate(element, value) {
             Object.defineProperty(event, 'target', { value: element });
             Object.defineProperty(event, 'currentTarget', { value: element });
             
-            console.log(`触发 ${eventConfig.type} 事件`);
             element.dispatchEvent(event);
         }, index * 20); // 每个事件间隔20ms
     });
@@ -126,20 +113,7 @@ function forceReactUpdate(element, value) {
     }, eventSequence.length * 20 + 50);
 }
 
-// 或者使用 React Test Utilities 风格
-function simulateReactChange(element, value) {
-    element.value = value;
-    
-    // React 16+ 使用这些事件
-    element.dispatchEvent(new Event('input', { bubbles: true }));
-    element.dispatchEvent(new Event('change', { bubbles: true }));
-    
-    // 对于 React 17+
-    element.dispatchEvent(new Event('change', { 
-        bubbles: true,
-        composed: true 
-    }));
-}
+
 
 function runJob () {
     document.querySelectorAll('[aria-label="percentageInput"]').forEach(element => {