Skip to content
DevFlash
FreeJunior~20 minDraft, awaiting review

Counter with limits and step

Small component, real requirements: limits, step, disabled states and reset.

Requirements

  • Show the value in an element with data-testid="count".
  • Buttons named Increment and Decrement move by step (default 1).
  • Clamp to [min, max] and disable the button at each limit.
  • Every click counts, even several in a row.
  • Reset returns to the initial value.

Out of scope

  • Styling. The tests only look at behavior and accessible names.

Hints

See the commented solutionReport a problem
Starting the editor…