Questions tagged «react-testing-library»

5
您如何使用Jest和react-testing-library测试元素的不存在?
我有一个组件库,我正在编写使用Jest和react-testing-library的单元测试。基于某些道具或事件,我想验证是否未渲染某些元素。 getByText,,getByTestId等引发错误,react-testing-library如果找不到该元素,则会导致该expect函数触发之前测试失败。 您如何使用react-testing-library测试是否在笑话中不存在?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.