diff --git a/tests/result-img-doubleclick-test.js b/tests/result-img-doubleclick-test.js index c232627..ee3ab0c 100644 --- a/tests/result-img-doubleclick-test.js +++ b/tests/result-img-doubleclick-test.js @@ -14,6 +14,8 @@ const React = { return { type, props: Object.assign({}, props || {}, { children }) } }, useState(init) { return [init, function () {}] }, + // 183 起 ResultImg 用 useEffect 订阅落地状态;假 React 必须提供(既有失败,与本次回滚无关) + useEffect(fn) { try { const c = fn && fn(); if (typeof c === 'function') c() } catch (e) { /* ignore */ } }, } const sandbox = { React } vm.runInNewContext(fs.readFileSync(path.join(root, 'src', 'ui-components.js'), 'utf8'), sandbox)