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

Fix maximumSelectionLength being ignored by closeOnSelect #5581

Merged
merged 2 commits into from Jul 21, 2019
Merged

Conversation

kevin-brown
Copy link
Member

This pull request includes a

  • Bug fix
  • New feature
  • Translation

The following changes were made

  • Fix maximumSelectionLength being ignored by closeOnSelect
  • Rewrote tests to match other unit tests for Select2
  • Added new test to ensure the select event is listened to

If this is related to an existing ticket, include a link to it as well.

Fixes #3514
Fixes #3860
Closes #5333

These brings the tests in line with other tests which we have, and
makes it easier to understand what is actually going on in the tests.

This also removes a redundant set of tests where we were testing with
=> 2 options being allowed. There are no current edge cases that would
have required this.
There was a bug where the `maximumSelectionLength` option would not
kick in if the `closeOnSelect` option was enabled. Normally, this
was enabled by someone in their global configuration, but it could
also be seen when somoene selected an option while holding the
meta/ctrl/alt keys. This would implicitly enable the `closeOnSelect`
behaviour, even when it was not globally enabled, and cause the bug.

This fixes that issue by listening to the `select` event which is
triggered whenever an option is selected, and triggers the "maximum
selected" message based on that event. This should now force the
message to be displayed, even when the results did not have to be
queried another time.

Fixes #3514
Fixes #3860
Closes #5333
@kevin-brown kevin-brown added this to the 4.0.9 milestone Jul 21, 2019
@kevin-brown kevin-brown changed the title Fix maximumSelectionLength being ignored by closeOnSelect Fix maximumSelectionLength being ignored by closeOnSelect Jul 21, 2019
@kevin-brown kevin-brown merged commit 2fce8ae into develop Jul 21, 2019
@kevin-brown kevin-brown deleted the GH-3514 branch July 21, 2019 19:44
@kevin-brown kevin-brown mentioned this pull request Jul 21, 2019
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant