- 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:

推薦閱讀
- Python數據分析基礎
- Production Ready OpenStack:Recipes for Successful Environments
- Learning Linux Binary Analysis
- Learning OpenCV 3 Computer Vision with Python(Second Edition)
- Visual C++開發入行真功夫
- 編程與類型系統
- C語言從入門到精通
- Unity 3D/2D移動開發實戰教程
- Learning Modular Java Programming
- 編程可以很簡單
- 奔跑吧 Linux內核
- Get Your Hands Dirty on Clean Architecture
- Visual Basic程序設計基礎
- 零基礎學SQL(升級版)
- iOS Development with Xamarin Cookbook