All files / components/Game GameSelect.jsx

100% Statements 3/3
100% Branches 1/1
100% Functions 3/3
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31                157x             373x         7x                    
import { Form } from "react-bootstrap";
 
function GameSelect({
  game,
  handleGameSelection,
  selectedGame,
  testid = "GameSelect",
}) {
  return (
    <Form.Group className="mb-3">
      <Form.Text htmlFor="game" className="fw-bold fs-5">
        Game
      </Form.Text>
      <div className="ms-3" data-testid={`${testid}-GameSelect-div`}>
        {game.map((object) => (
          <Form.Check
            key={object.id}
            type="radio"
            label={object.name}
            data-testid={`${testid}-game-${object.id}`}
            onChange={() => handleGameSelection(object.id, object.name)}
            checked={selectedGame === object.id}
          />
        ))}
      </div>
    </Form.Group>
  );
}
 
export default GameSelect;