Bench and lineup transfer list capped at five players
A five-a-side football coach picks the starting lineup before each match. Build a transfer list with two columns, Bench and Lineup. The coach checks players and moves them from one column to the other. The lineup holds at most 5 players.
The starter code includes these constants:
const ROSTER = ['Avery', 'Bruno', 'Chen', 'Dara', 'Emeka', 'Farah', 'Goran', 'Hana'];
const INITIAL_LINEUP = ['Chen', 'Farah'];
const MAX_LINEUP = 5;
At first, the lineup holds Chen and Farah, and every other player is on the bench.
aria-label="Bench" or aria-label="Lineup", for example <ul aria-label="Bench">.Bench (6) and Lineup (2/5).No players.ROSTER), no matter when or in what order they were moved.Lineup is full.Only 3 spots left (with the real number). Use Only 1 spot left for a single spot.Start: Bench: Avery Bruno Dara Emeka Goran Hana Lineup: Chen Farah (2/5)
Check Emeka, Bruno, Add: Bench: Avery Dara Goran Hana Lineup: Bruno Chen Emeka Farah (4/5)
Check Avery, Dara: "Only 1 spot left", Add selected disabled
Uncheck Dara, Add: Bench: Dara Goran Hana Lineup: Avery Bruno Chen Emeka Farah (5/5)
"Lineup is full", Fill lineup disabled
Check Chen, Bench sel.: Bench: Chen Dara Goran Hana Lineup: Avery Bruno Emeka Farah (4/5)
The tests click checkboxes and buttons and read the screen like a user would. You don’t need test ids, specific class names, or an exact HTML structure. They check that:
Bench and Lineup. The names of the checkboxes inside each one (from their <label> or aria-label) appear in roster order.checked property follows the rules above.<button> elements contain the texts above, and their disabled property follows the rules above.Bench (6), Lineup (2/5)), No players inside an empty list, and the capacity messages. Capitalization and extra spacing don’t matter.