-
Notifications
You must be signed in to change notification settings - Fork 65
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: correctly validate required TimePicker #1716
Conversation
This pull request is being automatically deployed with Vercel (learn more). widget-test-docs – ./🔍 Inspect: https://vercel.com/dojo/widget-test-docs/6eYDhPjwJBeJujeHg2xKwuwBLXar dojo.widgets – ./🔍 Inspect: https://vercel.com/dojo/dojo.widgets/3mnjkR1Gi5wnCYQhCn4SxFj5ZaAh |
Codecov Report
@@ Coverage Diff @@
## master #1716 +/- ##
==========================================
+ Coverage 90.17% 90.24% +0.07%
==========================================
Files 94 94
Lines 5088 5116 +28
Branches 1384 1392 +8
==========================================
+ Hits 4588 4617 +29
+ Misses 247 244 -3
- Partials 253 255 +2
Continue to review full report at Codecov.
|
@@ -335,7 +335,7 @@ export const TimePicker = factory(function TimePicker({ | |||
} | |||
} | |||
|
|||
isValid = validationMessages.length === 0; | |||
isValid = isValid === undefined ? validationMessages.length === 0 : isValid; |
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.
This was the root of the issue: The underlying TextInput
updates inputIsValid
, but then local validation and validationMessages.length
ended up overwriting this before triggering onValidate
.
@bitpshr should this be showing as visibly valid, ie. green, when set to required and with a value passed? It appears that it currently does not. Also, it looks like the dojo themed time picker now shows as valid / green as soon as it is rendered even though it's not supposed to. |
@tomdye: The Material I think we are good on both issues for this specific fix. |
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.
This works for me, I'd like to get @tomdye's approval and also a test to cover the changes?
</div> | ||
); | ||
}); | ||
const buttonTemplate = (required?: boolean) => |
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.
test looks good, but we've tried really hard to remove any need for these getRender
/ getTemplate
functions via the addition of the assertion template so I'd rather we didn't add one here when you could simply to
const requiredTemplate = baseTemplate
.setProperty('@input', 'required', true)
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.
Added a comment re. how setProperty
should be used on the baseTemplate
, once that's fixed please merge
Type: bug
The following has been addressed in the PR:
.dojorc
theme.variant()
is added to the root domnodetheme.compose
like thisDescription:
This pull request fixes an issue with
TimePicker
that prevented required instances from failing validation.Resolves #1714