Skip to content

FORMS-25983 Add min/max cross-validation to authoring dialogs#1910

Open
AnurudraS wants to merge 5 commits into
devfrom
FORMS-25983-dev
Open

FORMS-25983 Add min/max cross-validation to authoring dialogs#1910
AnurudraS wants to merge 5 commits into
devfrom
FORMS-25983-dev

Conversation

@AnurudraS

@AnurudraS AnurudraS commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

#1903

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

Anurudra Shukla and others added 5 commits June 23, 2026 11:50
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

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AnurudraS

Copy link
Copy Markdown
Contributor Author

// todo: leadDigits and fracDigits are not supported as of today
commented by @rismehta in 2024 the check is not always failing but the code is there.

@AnurudraS AnurudraS requested a review from devgurjar June 23, 2026 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant