All files / components/Utils BinSizeSelector.jsx

100% Statements 27/27
100% Branches 4/4
100% Functions 2/2
100% Lines 27/27

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 32 33 34 351x 1x   1x 119x 119x 119x 119x 119x 5x 5x 3x 3x 5x   119x 119x 119x     119x 119x 119x 119x 119x 119x 119x 119x 119x 119x       119x  
import React from "react";
import { Form } from "react-bootstrap";
 
export default function BinSizeSelector({
  value,
  onChange,
  testid = "bin-size-selector",
}) {
  const handleChange = (e) => {
    const parsed = parseInt(e.target.value, 10);
    if (!isNaN(parsed) && parsed >= 1) {
      onChange(parsed);
    }
  };
 
  return (
    <Form.Group className="d-flex align-items-center gap-2 mt-2">
      <Form.Label htmlFor="binSize" className="mb-0">
        Bin Size
      </Form.Label>
      <Form.Control
        id="binSize"
        data-testid={testid}
        type="number"
        min="1"
        step="1"
        value={value}
        onChange={handleChange}
        // Stryker disable next-line all : this is for styling, which is unnecessary to test
        style={{ width: "100px" }}
      />
    </Form.Group>
  );
}