Skip to content

Fix: Add runtime validation for _correctRange values (fixes #231)#232

Merged
oliverfoster merged 1 commit intomasterfrom
issue/231
Apr 13, 2026
Merged

Fix: Add runtime validation for _correctRange values (fixes #231)#232
oliverfoster merged 1 commit intomasterfrom
issue/231

Conversation

@swashbuck
Copy link
Copy Markdown
Contributor

Fixes #231

Fix

  • Add validateCorrectRange() method to SliderModel that runs during init(), before setupModelItems()
  • Detect and correct invalid _correctRange configurations with console warnings:
    • Inverted range (_bottom > _top) - values are swapped
    • Out-of-bounds values - clamped to _scaleStart/_scaleEnd
    • Misaligned step values - snapped to nearest valid _scaleStep increment

Testing

  1. Configure a Slider with an inverted range (e.g. _bottom: 9, _top: 4) - verify console warning and correct scoring
  2. Configure with out-of-bounds values (e.g. _bottom: 50 on a scale ending at 10) - verify clamping and warning
  3. Configure with step-misaligned values (e.g. _bottom: 3 with _scaleStep: 2 starting at 1) - verify snapping to nearest step
  4. Verify normal valid ranges still work without warnings
  5. Verify _correctAnswer mode is unaffected (validation skips when _correctAnswer is set)

Performance Impact

None - validation runs once during init() with O(1) operations

@swashbuck swashbuck added the bug label Mar 27, 2026
@swashbuck swashbuck self-assigned this Mar 27, 2026
@swashbuck swashbuck moved this from New to Needs Reviewing in adapt_framework: The TODO Board Mar 27, 2026
@swashbuck swashbuck requested a review from danielghost March 27, 2026 15:29
@oliverfoster oliverfoster merged commit aff7436 into master Apr 13, 2026
1 check passed
@oliverfoster oliverfoster deleted the issue/231 branch April 13, 2026 09:19
@github-project-automation github-project-automation Bot moved this from Needs Reviewing to Recently Released in adapt_framework: The TODO Board Apr 13, 2026
github-actions Bot pushed a commit that referenced this pull request Apr 13, 2026
## [4.10.1](v4.10.0...v4.10.1) (2026-04-13)

### Fix

* Add runtime validation for _correctRange values (fixes #231) (#232) ([aff7436](aff7436)), closes [#231](#231) [#232](#232)
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 4.10.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Recently Released

Development

Successfully merging this pull request may close these issues.

No runtime validation of _correctRange values

2 participants