我使用 react-final-form 库。我用酶+笑话测试它。如何测试 submitting
条件?我不明白如何用酶改变这个值。
const MyForm = (formProps) => {
return (
<Form
mutators={{
{...formProps}
render={(renderProps) => {
const {
handleSubmit,
submitting,
} = renderProps;
return submitting ? ( // I want to test this condition
<Spinner />
) : (
<form onSubmit={handleSubmit} className='edit-ukd-form'>
<div>
<label>First Name</label>
<Field
name="firstName"
component="input"
type="text"
placeholder="First Name"
/>
</div>
</form>
);
}}
/>
);
}