fix: render validation state on DateTimeControl and ColorPicker - #127
Merged
Conversation
Both controls used StandardValidationTrait but never declared `implements IValidationInput`. BootstrapRenderer::renderControl() gates the showValidation() call on that interface, so the input never received `is-invalid`. The <div class="invalid-feedback"> was emitted all along, but Bootstrap styles it `display: none` unless a sibling input carries `is-invalid` — so the error message was rendered yet invisible. Affects addDate(), addDateTime(), addTime() and addColor(). Closes #113 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #127 +/- ##
=========================================
Coverage 96.94% 96.94%
Complexity 308 308
=========================================
Files 25 25
Lines 983 983
=========================================
Hits 953 953
Misses 30 30 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Rendering a BootstrapForm resolves the presenter via lookup(); on the lowest supported nette/application that throws when the form has no parent, so the two new tests failed under --prefer-lowest while passing against current dependencies. Use the presenter-mock + non-empty action convention already used by the renderer tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #113
Problem
DateTimeControl(backingaddDate(),addDateTime(),addTime()) usesStandardValidationTrait, which suppliesshowValidation()— but the class never declaredimplements IValidationInput.BootstrapRenderer::renderControl()gates that call on the interface:so the input never received
is-invalid.The
<div class="invalid-feedback">was in fact emitted all along. Bootstrap styles.invalid-feedbackasdisplay: noneunless a sibling input carries.is-invalid, which is why the message rendered but stayed invisible — matching the screenshot in the issue.Fix
Added
implements IValidationInputtoDateTimeControl.ColorPickerhad the identical trait/interface mismatch — found by auditing every class insrc/Inputs/— and is fixed the same way. Those two were the only ones;DateInput/DateTimeInputinherit the interface viaTextInput.No renderer changes. No
tests/data/fixtures shifted — none exercise an errored date or color field.Verified
addDate/addDateTime/addTime/addColor, each with an error →is-invalidplus a visible feedback div$form->showValidation = truewith no errors →is-valid, consistent withTextInputBootstrapRow/BootstrapCellgrid cellgetControl()without the renderer → unchangedmake tests(150 tests),make phpstan(level 7),make csall green. Regression tests added toDateTimeControlTestandColorPickerTest.🤖 Generated with Claude Code