FORMS-25983 Add min/max cross-validation to authoring dialogs#1910
Open
AnurudraS wants to merge 5 commits into
Open
FORMS-25983 Add min/max cross-validation to authoring dialogs#1910AnurudraS wants to merge 5 commits into
AnurudraS wants to merge 5 commits into
Conversation
Prevent authors from setting a minimum value greater than its paired maximum (minLength/maxLength, minimum/maximum, minItems/maxItems, minimumDate/maximumDate, minimumDateTime/maximumDateTime, minOccur/maxOccur) across all affected form components. All pairs are registered centrally in Utils so new components only need one entry added — no per-component editDialog.js changes required. Real-time inline feedback via change listeners; dialog save blocked via foundation.validation.validator registered once at page load. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1. Fix parseInt bug for decimal ranges in numberinput — use NUMBER_COMPARE (Number()) instead of INT_COMPARE (parseInt()) so min=1.6 / max=1.4 is correctly flagged as invalid. 2. Remove direct field.invalid mutation from handleMinMaxValidation — trigger change events instead so the foundation-validation framework re-runs all validators and avoids overwriting required/pattern errors. 3. Wrap foundation-contentloaded handler in Coral.commons.ready so fields are fully upgraded before values are read; add early exit for non-dialog fragments. 4. Move per-component selector strings and registrations into each component's own editDialog.js (textinput, numberinput, fileinput/v1, datepicker, datetime) using that file's existing selector constants. utils.js now only hosts the panelcontainer entry, which is shared across accordion/wizard/tabsontop/verticaltabs/fragment (none have editDialog.js). 5. Fix DATE_COMPARE to guard against invalid date strings. 6. Add wrapperClass to datetime dialog XML for minimumDateTime/maximumDateTime fields, replacing the brittle attribute-name selector. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…eview fixes 1. Pass jQuery-wrapped dialog instead of raw e.target to the handler — dialog.find() requires jQuery; passing e.target caused TypeError on every panelcontainer/tabsontop/accordion dialog open. 2. Revert validate() to direct invalid mutation — triggering change events in the listener caused infinite recursion because jQuery trigger fires native DOM events which re-enter the same addEventListener callback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…max tests cy.type() on a coral-numberinput focuses its inner <input>, so chaining .blur() on the wrapper element fails Cypress's focused-element check. Split each chain to use cy.focused().blur() instead. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…numberinput
coral-numberinput is a custom element not in Cypress's clearable list.
Use .find('input') to target the native inner input before .clear()/.type().
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
Author
|
// todo: leadDigits and fracDigits are not supported as of today |
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.
Description
#1903
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: