From 45e9b1d24e9fbf1a9097e909491b7e64058f11c0 Mon Sep 17 00:00:00 2001 From: Nick Schonning Date: Tue, 1 Dec 2020 01:48:31 -0500 Subject: [PATCH] fix: Down arrow test --- test/tests/spinbutton_datepicker.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/tests/spinbutton_datepicker.js b/test/tests/spinbutton_datepicker.js index 4d0caa48d4..a54fe2408c 100644 --- a/test/tests/spinbutton_datepicker.js +++ b/test/tests/spinbutton_datepicker.js @@ -370,17 +370,23 @@ ariaTest( exampleFile, 'spinbutton-down-arrow', async (t) => { - let control = parseInt(ex.dayNow); - let daysInMonth = parseInt(ex.dayMax); + let control = 31; + + // Set to December for a 31 day month + let monthSpinner = await t.context.session.findElement( + By.css(ex.monthSelector) + ); + await monthSpinner.sendKeys(Key.END); // Send down arrow to day date spinner let daySpinner = await t.context.session.findElement( By.css(ex.daySelector) ); - await daySpinner.sendKeys(Key.ARROW_DOWN); - // Subtract a day to the control - control = (control - 1) % daysInMonth; + // Set to first of month + await daySpinner.sendKeys(Key.HOME); + + await daySpinner.sendKeys(Key.ARROW_DOWN); t.is( parseInt(await daySpinner.getText()), @@ -395,7 +401,7 @@ ariaTest( } // Subtract 30 days to the control - control = daysInMonth + ((control - 30) % daysInMonth); + control -= 30; t.is( parseInt(await daySpinner.getText()),