-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spin Button Date Picker: Fix unreliable date math test #1639
Conversation
Regression test coverage:Examples without any regression tests:
Examples missing some regression tests:
Example pages with Keyboard or Attribute table rows that do not have data-test-ids:
SUMMARY:55 example pages found. ERROR - missing tests: Please write missing tests for this report to pass. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Makes sense.
Thanks @spectranaut !
@spectranaut |
aa50016
to
2d1bd20
Compare
2d1bd20
to
45e9b1d
Compare
@@ -408,6 +414,7 @@ ariaTest( | |||
|
|||
ariaTest('up arrow on month', exampleFile, 'spinbutton-up-arrow', async (t) => { | |||
let date = new Date(); | |||
date.setDate(1); // This is necessary to do the correct date math for months. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this part still needed?
When you get towards the end of the month and try to add a month, Javascript Date objects start to do unexpected things. This is causing failures in the CI for all regression tests run today. This is the issue:
The second line increases the date by one month, resulting in date being December 1st, 2020, because there is no November 31st.
The fix is to put the day of the month to the 1st using
date.setDate(1)
before doing any math, because all months have the 1st of the month.