- Mastering React Test:Driven Development
- Daniel Irvine
- 98字
- 2021-06-24 14:45:10
Finishing off the form with a submit button
It's a good time to add a submit button and perform a manual test to check what you've created. A submit button test is relatively simple. Add the following test to your test file:
it('has a submit button', () => {
render(<CustomerForm />);
const submitButton = container.querySelector(
'input[type="submit"]'
);
expect(submitButton).not.toBeNull();
});
Then, make that pass by adding in your submit button into the form, at the bottom:
<form id="customer" onSubmit={handleSubmit}>
...
<input type="submit" value="Add" />
</form>
Update your entrypoint in src/index.js to render a new CustomerForm instance, rather than an AppointmentsDayView, and you should be ready to manually test:

推薦閱讀
- Learning Python Web Penetration Testing
- JavaScript高效圖形編程
- Delphi程序設計基礎:教程、實驗、習題
- GeoServer Cookbook
- Hands-On Machine Learning with scikit:learn and Scientific Python Toolkits
- Instant Apache Stanbol
- Mastering Unity Shaders and Effects
- 領域驅動設計:軟件核心復雜性應對之道(修訂版)
- HTML5 APP開發從入門到精通(微課精編版)
- Mobile Device Exploitation Cookbook
- Julia數據科學應用
- Kotlin進階實戰
- 微前端設計與實現
- 黑莓(BlackBerry)開發從入門到精通
- 企業級Java現代化:寫給開發者的云原生簡明指南