From be6b049a6b62ac82244c601cfceba42a2ffc8695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB=20Bijl?= <5457769+ZoeBijl@users.noreply.github.com> Date: Fri, 25 Feb 2022 20:40:28 +0100 Subject: [PATCH] fix(#2238): adds catch for when control number is 0 (#2242) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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). --- test/tests/spinbutton_datepicker.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/tests/spinbutton_datepicker.js b/test/tests/spinbutton_datepicker.js index 42b75f6a87..fb12062956 100644 --- a/test/tests/spinbutton_datepicker.js +++ b/test/tests/spinbutton_datepicker.js @@ -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,