Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add min and max validation in TTY::Prompt::MultiList #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Thomascountz
Copy link
Owner

Describe the change

  • Add a MultiList#validate_min_max method to ensure min is less than or equal to max
  • Call validate_min_max during initialization and when setting min and max values
  • Update MultiList#keyenter to check both min and max constraints are satisfied on selection
  • Update output_helper method in multi_select_spec.rb to support both min and max help text

Why are we doing this?

This PR introduces validation logic to ensure that the min value is less than or equal to the max value in the TTY::Prompt::MultiList class. This would close piotrmurach#172 and piotrmurach#173.

Benefits

This change prevents invalid configurations and ensures that the selection constraints are properly enforced.

Drawbacks

Possible drawbacks applying this change.

Requirements

  • Tests written & passing locally?
  • Code style checked?
  • Rebased with master branch?
  • Documentation updated?
  • Changelog updated?

- Add a `MultiList#validate_min_max` method to ensure `min` is less than or equal to `max`
- Call `validate_min_max` during initialization and when setting `min` and `max` values
- Update `MultiList#keyenter` to check both `min` and `max` constraints are satisfied on selection
- Update `output_helper` method in `multi_select_spec.rb` to support both `min` and `max` help text
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.

multi_select validation for "min" option ignored if "max" validation passes
1 participant