用Jest和酶测试Ref元素

时间:2020-05-12 08:22:49

标签: reactjs typescript redux

我正在将HOC元素(PolymerWrapper)与用于TS的自定义Web组件一起使用。 但是由于这种包装,ref元素的结构看起来像这样:

enter image description here

因此,要获取DOM元素,我需要采用以下方式:customRef.current.ref.current

当我编写测试时,由于[ref.current],它总是在'mount'中失败:

enter image description here enter image description here

也许有人知道我如何使用酶测试该参考组件?

0 个答案:

没有答案