All files / components/Commons CommonsSelect.jsx

100% Statements 21/21
100% Branches 2/2
100% Functions 2/2
100% Lines 21/21

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 311x   149x 149x 149x 149x 149x 149x 149x 149x 149x     149x 149x 149x 149x 149x 149x 149x 149x 149x           149x   1x  
import { Form } from "react-bootstrap";
 
function CommonsSelect({
  commons,
  handleCommonsSelection,
  selectedCommons,
  testid = "CommonsSelect",
}) {
  return (
    <Form.Group className="mb-3">
      <Form.Text htmlFor="commons" className="fw-bold fs-5">
        Commons
      </Form.Text>
      <div className="ms-3" data-testid={`${testid}-CommonsSelect-div`}>
        {commons.map((object) => (
          <Form.Check
            key={object.id}
            type="radio"
            label={object.name}
            data-testid={`${testid}-commons-${object.id}`}
            onChange={() => handleCommonsSelection(object.id, object.name)}
            checked={selectedCommons === object.id}
          />
        ))}
      </div>
    </Form.Group>
  );
}
 
export default CommonsSelect;