May 2019
Intermediate to advanced
496 pages
10h 38m
English
Let's add a label to the field so the user knows what they are typing in:
const labelFor = formElement => container.querySelector(`label[for="${formElement}"]`);it('renders a label for the first name field', () => { render(<CustomerForm />); expect(labelFor('firstName')).not.toBeNull(); expect(labelFor('firstName').textContent).toEqual('First name');});
Make this pass by changing the JSX fragment to read as follows:
<form id="customer"> <label htmlFor="firstName">First name</label> <input type="text" name="firstName" value={firstName} readOnly /></form>
Read now
Unlock full access