Problem statement
A cart quantity control built with Vanilla TypeScript and standard DOM APIs. The page provides the finished stepper markup — a decrement button, a numeric input, and an increment button — but none of the controls do anything, so a shopper can order a negative amount or more than the available stock.
Demo
The page, styles, and stepper markup are already scaffolded and wired. Only the initializeQuantityStepper function is missing — implement it in src/js/quantityStepper.ts so every test passes. Do not edit any other file.
What to implement
- Make the increment button raise the quantity by one, and the decrement button lower it by one.
- Keep the quantity between one and the maximum you are given, no matter how the user interacts with the control.
- Keep the input showing the current quantity at all times.
- Turn off the decrement button once the quantity reaches the lowest allowed value, and the increment button once it reaches the maximum.
- Turn a button back on as soon as the quantity moves away from that limit.
- Pull a quantity typed straight into the field back into the allowed range once the user clicks away.
- Report the new quantity through the callback you were given every time the quantity changes.
- Stay silent when an interaction leaves the quantity exactly as it was.
- The limit must come from the maximum you were given — nothing should be hardcoded.
- Work with the controls already on the page, without replacing them or touching anything else in the document.
