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

multi_select validation for "min" option ignored if "max" validation passes #172

Open
sveinn opened this issue Aug 4, 2021 · 1 comment · May be fixed by #173 or Thomascountz/tty-prompt#1
Open

Comments

@sveinn
Copy link

sveinn commented Aug 4, 2021

Describe the problem

When both :min and :max options are passed to multi_select, the min option is ignored if number of selections is less than or equal to the max option value. Expected behavior to ensure number of selected items is between min and max values.

Steps to reproduce the problem

1. run `TTY::Prompt.new.multi_select("Select:", %w(one two), min: 1, max: 1)`
2. don't make a selection and hit enter
3. observed: prompt returns 
4. desired: prompt validates the min requirement

Actual behaviour

image

Expected behaviour

When enter is hit and the number of selections is less than :min, I expect the prompt to not return.

Cause

image
^ as long as max is valid min is ignored

Describe your environment

  • OS version: MacOS 10.15.7
  • Ruby version: 2.7.1
  • TTY::Prompt version: 0.23.1
@sveinn sveinn linked a pull request Aug 4, 2021 that will close this issue
5 tasks
@piotrmurach
Copy link
Owner

Hi Sveinn 👋

Thanks for using tty-prompt and submitting this issue report. Good spot! I left some comments on your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants