【发布时间】:2019-02-01 16:39:38
【问题描述】:
我正在使用这个组件:
<AceEditor
value={data}
className="code-editor"
mode="json"
theme="dracula"
onChange={setData}
name="data"
height="320px"
width="100%"
editorProps={{ $blockScrolling: true }}
showPrintMargin={false}
highlightActiveLine={false}
/>
那么,如何使用 react-testing-library 获取此组件并触发 onChange 事件?我试图找到一些类似 getByComponentName 或类似的功能,但没有成功。
【问题讨论】:
-
需要更多信息,如果你正在使用 react-ace,github.com/securingsincity/react-ace。声明一个函数并在
onChange上调用它 -
好的@SaahithyanVigneswaran,但我怎样才能在规范上触发这个功能?
标签: javascript reactjs react-testing-library