我正在尝试测试我的使用带有npm包react-test-renderer的React-Data-Grid的应用程序,但失败了。
例如,我已将基本示例复制到文件Example.js中 https://adazzle.github.io/react-data-grid/scripts/example01-basic.js
,我正在调用对象。
describe('Testing ReactDataGrid ', () => {
test('Render without crashing', () => {
const myRender = renderer.create(<Example />)
let tree = myRender.toJSON()
expect(tree).toMatchSnapshot()
})
})
但是我崩溃了...这里是堆栈。有谁可以帮助我吗?也许有人使用另一个库来测试React-data-grid。 谢谢。
TypeError:无法读取null的属性“ scrollTop”
at Canvas._this.getScroll (node_modules/react-data-grid/dist/react-data-grid.js:9537:36)
at Viewport._this.getScroll (node_modules/react-data-grid/dist/react-data-grid.js:12791:28)
at Grid.componentDidMount (node_modules/react-data-grid/dist/react-data-grid.js:10345:55)
at commitLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:6955:22)
at commitAllLifeCycles (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:8164:7)
at HTMLUnknownElement.callCallback (node_modules/react-test-renderer/cjs/react-test-renderer.development.js:2264:14)
at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:219:27)
at HTMLUnknownElementImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:126: