From c25e8de736010375ac2a5afb90adf2ea71f3bacb Mon Sep 17 00:00:00 2001 From: Wei Zhu Date: Mon, 23 Jul 2018 16:12:36 +0800 Subject: [PATCH] test: mock React.createRef --- tests/__mocks__/react.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/__mocks__/react.js b/tests/__mocks__/react.js index 072da8061c..b5a0a7321e 100644 --- a/tests/__mocks__/react.js +++ b/tests/__mocks__/react.js @@ -8,4 +8,13 @@ if (!React.createContext) { }; } +if (!React.createRef) { + React.createRef = () => { + const ref = function setRef(node) { + ref.current = node; + }; + return ref; + }; +} + module.exports = React;