Searchable roster with a shared add/edit form and remove
A food bank coordinates its weekend volunteers from a single admin page. Build the roster: a searchable list of volunteers, each with a shift, and one form that both adds new volunteers and edits existing ones. Coordinators can also remove volunteers who drop out.
The starter code includes the shifts and the starting roster:
const SHIFTS = ['Morning', 'Afternoon', 'Evening'];
const INITIAL_VOLUNTEERS = [
{ id: 1, name: 'Amara Okafor', shift: 'Morning' },
{ id: 2, name: 'Bruno Silva', shift: 'Evening' },
{ id: 3, name: 'Chen Wei', shift: 'Morning' },
{ id: 4, name: 'Dalia Haddad', shift: 'Afternoon' },
{ id: 5, name: 'Elif Demir', shift: 'Evening' },
];
aria-label that names the volunteer: Edit Amara Okafor and Remove Amara Okafor.Showing N of M volunteers, where N is the number of rows on screen and M is the roster size. When nothing matches, also show No volunteers match.<select> labelled Shift with the three shifts (Morning by default), and a submit button.
" Farah Nasser " becomes "Farah Nasser"). Then:
Name is required.{name} is already on the roster. In edit mode the volunteer being edited doesn’t count, so you can change only the shift.Start Showing 5 of 5 volunteers
Search " WEI " Chen Wei only, Showing 1 of 5
Search "zzz" Showing 0 of 5, No volunteers match
Name " Farah Nasser ", Shift Afternoon, Add volunteer
"Farah Nasser Afternoon" is added, Showing 6 of 6
Name "bruno SILVA", Add volunteer
"Bruno Silva is already on the roster", nothing added
Edit Bruno Silva Name "Bruno Silva", Shift Evening, button "Save changes"
Name "Bruno Costa", Shift Morning, Save changes
the row now reads "Bruno Costa Morning"
chen wei) is allowed in edit mode.The tests type into your inputs, pick shifts, click your buttons, and read the screen like a coordinator would. You don’t need test ids, specific class names, or an exact HTML structure. They check that:
<label>, aria-label, or placeholder all work). The tests set the Shift select’s value and fire input and change.aria-label (or text) Remove {name} exists. Their shift is read from the closest element around that button that contains the name.Showing N of M volunteers, No volunteers match, Name is required and is already on the roster appear as described.Hidden rows can be removed from the page or hidden (hidden, display: none, or visibility: hidden). Capitalization and extra spacing don’t matter.