小编sta*_*tan的帖子

使用 react-testing-library 测试 material-ui 数据网格的问题

我想测试我的 material-ui 数据网格的内容,但在测试中只呈现前 3 列(共 8 列)。我可以测试这 3 列的内容,没问题。
一切都在网络浏览器上正确呈现。

我最好的猜测是这是由于这些警告所说的渲染数据网格的宽度和高度,但我无法在文档中找到解决方案。

Material-UI: useResizeContainer - The parent of the grid has an empty width.
You need to make sure the container has an intrinsic width.
The grid displays with a width of 0px.

You can find a solution in the docs:
https://material-ui.com/components/data-grid/rendering/#layout

Material-UI: useResizeContainer - The parent of the grid has an empty height.
You need to make sure the container has an intrinsic height.
The grid displays with a height …
Run Code Online (Sandbox Code Playgroud)

reactjs jestjs material-ui react-testing-library

8
推荐指数
2
解决办法
2712
查看次数