dojo / widgets

:rocket: Dojo - UI widgets.
https://widgets.dojo.io
Other
88 stars 66 forks source link

Trigger onValidate when inital value is set on Select widget #1699

Closed samends closed 3 years ago

samends commented 3 years ago

Type: bug

Description: Select widget was not validating when there was an initial value set. Pending unit test

Resolves #1653

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployments, click below or on the icon next to each commit.

dojo.widgets – ./

🔍 Inspect: https://vercel.com/dojo/dojo.widgets/BzANLXZrW66BtYcmRqzDxQXtRB2g
✅ Preview: https://dojowidgets-git-fork-samends-select-validation-dojo1.vercel.app

widget-test-docs – ./

🔍 Inspect: https://vercel.com/dojo/widget-test-docs/7wqGjKLtyVQijxJYGdA1BeLX6ehb
✅ Preview: https://widget-test-docs-git-fork-samends-select-validation-dojo1.vercel.app

codecov[bot] commented 3 years ago

Codecov Report

Merging #1699 (1882fcb) into master (6337d81) will increase coverage by 0.21%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1699      +/-   ##
==========================================
+ Coverage   89.86%   90.07%   +0.21%     
==========================================
  Files          94       94              
  Lines        4953     5050      +97     
  Branches     1337     1373      +36     
==========================================
+ Hits         4451     4549      +98     
- Misses        248      249       +1     
+ Partials      254      252       -2     
Impacted Files Coverage Δ
src/select/index.tsx 86.95% <100.00%> (+0.86%) :arrow_up:
src/common/tests/support/test-helpers.ts 93.18% <0.00%> (-6.82%) :arrow_down:
src/tooltip/index.tsx 77.41% <0.00%> (ø)
src/action-button/index.tsx 100.00% <0.00%> (ø)
src/raised-button/index.tsx 100.00% <0.00%> (ø)
src/outlined-button/index.tsx 100.00% <0.00%> (ø)
src/date-input/nls/DateInput.ts 60.00% <0.00%> (ø)
src/loading-indicator/index.tsx 100.00% <0.00%> (ø)
src/floating-action-button/index.tsx 100.00% <0.00%> (ø)
src/slide-pane/index.tsx 87.39% <0.00%> (+0.10%) :arrow_up:
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6337d81...1882fcb. Read the comment docs.

samends commented 3 years ago

@tomdye this was added so that if there's an initial value set, the Select widget will validate it. I could change it so that it only validates when required (required && ( dirty || value !== undefined))

tomdye commented 3 years ago

@samends I believe that any passed onValidate function should be called but if required is not set to true it should not validate internally.