![](/img/trans.png)
[英]Enzyme unable to find children rendered inside React Apollo Query components
[英]enzyme: find() formik components inside an anonymous function
我正在使用酶來測試反應成分。 我有一個具有這種結構的formik表單:
表單.js
export class Form extends Component {
constructor(props) {
//...
}
render() {
<Formik
inititalValues={{
//...
}}
onSubmit={(values, { resetForm }) => {
//...
//...
}}
onReset = {(values, formProps) => {
//...
}}
validationSchema={
//...
}>
{
(props) => {
const {values, errors, handleSubmit} = props;
return (
<form onSubmit={handleSubmit}>
<input type='text' name='email' />
<input type='password' name='password' />
<button type='submit'>Submit</button>
</form>
)
}
}
</Formik>
}
}
我如何使用酶的 find() 方法來獲取這些輸入文件?
我可以獲得主要的<Formik>
組件,但無法獲得匿名 function 中的輸入字段。 任何幫助都將不勝感激。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.