Skip to content

Commit

Permalink
fix(#2238): adds catch for when control number is 0 (#2242)
Browse files Browse the repository at this point in the history
The example wraps. So in certain scenarios the control number will be 0. For example, 25th of February “minus” 31 days results in the code example to land on day 28. Due to the module on line 358 that would make the control number 0. This catches that and sets it to dayMax (same logic as in the code example itself).
  • Loading branch information
ZoeBijl authored and Michael Cooper committed May 2, 2022
1 parent 9d8af51 commit be6b049
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/tests/spinbutton_datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ ariaTest('up arrow on day', exampleFile, 'spinbutton-up-arrow', async (t) => {
// Add 30 days to the control
control = (control + 30) % daysInMonth;

if (control === 0) {
control = parseInt(ex.dayMax);
}

t.is(
parseInt(await daySpinner.getText()),
control,
Expand Down

0 comments on commit be6b049

Please sign in to comment.