May 2019
Intermediate to advanced
496 pages
10h 38m
English
We want to now duplicate those six tests for the last-name field. But how do we approach this? Well, we do it test-by-test, just as we did with the first name field. Only this time, we should go much faster as our tests are one-liners and the production code is a copy and paste job.
So, for example, the first test will be this:
describe('last name field', () => { itRendersAsATextBox('lastName');});
That can be made to pass by adding the following line to our JSX, just below the first-name input field:
<input type="text" name="lastName"/>
This is just the start for the input field: you'll need to complete it as you add in the next tests.
Go ahead and add the remaining five tests together with their implementation. ...
Read now
Unlock full access