我正在使用react-testing-library和jest。在 componentdidupdate 中尝试获取“ this.testRef.current.offsetHeight ”,即使在加载内容后,offsetHeight 仍为0 。我想要 DOM 的精确 offsetHeight 因为有一些基于它的条件。
在反应测试库和笑话中是否有任何可能的解决方案可以解决。
我正在使用angerouslySetInnerHTML来绑定testRef 元素的html 内容。
dom reactjs jestjs react-testing-library
dom ×1
jestjs ×1
react-testing-library ×1
reactjs ×1