From 63e29f77e8d13d5239435f58f85152aeec20a821 Mon Sep 17 00:00:00 2001 From: Sergey Vinogradov Date: Fri, 6 May 2022 15:45:46 +0300 Subject: [PATCH] test: speed up the keyboard tests (#3798) --- .../src/vaadin-date-picker-overlay-content.js | 15 ++++++++++++--- .../date-picker/test/keyboard-navigation.test.js | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/date-picker/src/vaadin-date-picker-overlay-content.js b/packages/date-picker/src/vaadin-date-picker-overlay-content.js index dee1240747..ff61ee9fc4 100644 --- a/packages/date-picker/src/vaadin-date-picker-overlay-content.js +++ b/packages/date-picker/src/vaadin-date-picker-overlay-content.js @@ -233,6 +233,11 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po static get properties() { return { + scrollDuration: { + type: Number, + default: 300, + }, + /** * The value for this element. */ @@ -524,7 +529,6 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po return (-c / 2) * (t * (t - 2) - 1) + b; }; - var duration = animate ? 300 : 0; var start = 0; var initialPosition = this.$.monthScroller.position; @@ -532,8 +536,13 @@ class DatePickerOverlayContent extends ControllerMixin(ThemableMixin(DirMixin(Po start = start || timestamp; var currentTime = timestamp - start; - if (currentTime < duration) { - var currentPos = easingFunction(currentTime, initialPosition, this._targetPosition - initialPosition, duration); + if (currentTime < this.scrollDuration) { + var currentPos = easingFunction( + currentTime, + initialPosition, + this._targetPosition - initialPosition, + this.scrollDuration, + ); this.$.monthScroller.position = currentPos; window.requestAnimationFrame(smoothScroll); } else { diff --git a/packages/date-picker/test/keyboard-navigation.test.js b/packages/date-picker/test/keyboard-navigation.test.js index d94511be22..94c1330a8e 100644 --- a/packages/date-picker/test/keyboard-navigation.test.js +++ b/packages/date-picker/test/keyboard-navigation.test.js @@ -126,6 +126,7 @@ import { getDefaultI18n, getFocusedCell, getOverlayContent, open, waitForScrollT overlay = fixtureSync(` `); overlay.i18n = getDefaultI18n();