-
Notifications
You must be signed in to change notification settings - Fork 832
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
Fix ternary condition for default mask values #1797
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/mui-org/material-ui-pickers/g0etz8n47 |
Test summaryRun details
View run in Cypress Dashboard ➡️ This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
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.
Could you add a regression test case with the enzyme mount API?
I'm not familiar with that. |
Holey moley, that javascript |
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.
~I couldn't find how to reproduce this issue in the CI. ~
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.
Actually, I can still reproduce the issue with the above change. It seems that it doesn't solve the problem.
You're right. I attempted to fix the original issue by adding However, this doesn't fix the underlying issue tracked in #1776, which is that the mask should be correct automatically. My application happens to be single-locale, so I can just hard-code the correct mask, but not every application can do so, and it shouldn't be necessary. So to really fix #1776, the hard-coded masks that match the American date format need to be replaced with something more dynamic. I have removed the "fixes #1776" claim from this PR. I still think it fixes a bug though. |
@Philipp91 Awesome, thanks for the extra context! I have tried to add a test case but without any luck. It seems that the mask is ignored. I don't understand why. |
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/mui-org/material-ui-pickers/r36nbskxx |
@Philipp91 I'm sorry. I'm making no progress on this one. I'm giving up. A few observations:
component.find('input').simulate('change', {
target: {
value: '12',
},
});
expect((component.find('input').getDOMNode() as HTMLInputElement).value).toBe('12');
|
To reproduce and verify that this PR works, even if it doesn't fully resolve the issue:
I've posted a proposal for the real fix of the underlying issue. That real fix likely won't make the broken ternary expression go away, so it's worth fixing it anyway. |
@Philipp91 Awesome, thanks for the diff. I could figure a regression test out :). |
Rebased to fix the conflicts |
I'm excited about the new test 🎉 :) @Philipp91 Thanks so much for the help. We wouldn't have made it without you. |
No description provided.