Choosing a value from a select box
Let’s start by creating a component for booking new appointments, named AppointmentForm
.
The first field is a select box for choosing which service the customer requires: cut, color, blow-dry, and so on. Let’s create that now:
- Create a new file,
test/AppointmentForm.test.js
, with the following test and setup:import React from "react"; import { initializeReactContainer, render, field, form, } from "./reactTestExtensions"; import { AppointmentForm } from "../src/AppointmentForm"; describe("AppointmentForm", () => { beforeEach(() => { initializeReactContainer(); }); it("renders a form", () => { render(<AppointmentForm />); expect(form()).not.toBeNull(); }); });
- Make this test pass by implementing...