Skip to content

Conversation

ianawilson
Copy link

This is a solution for #3169, based on @gmitra's suggestion.

I made an attempt to write tests for this, but I'm not terribly familiar with the select2 code base, how the decorators work under the hood, or exactly how things should be pieced together in the unit test, so I had some trouble with it. Strangely, I couldn't even get the test to reproduce the original issue (the infinite loop), so there's something pretty wrong with my test draft.

You can see my first attempt at the tests here: select2:master...ianawilson:select-on-close-loop-tests

If anyone is interested to help me figure out and fix the unit tests, I'd be happy to get those in here and working.

tzellman pushed a commit to tzellman/select2 that referenced this pull request Feb 2, 2016
This fixes an infinite loop that used to be caused when both
`closeOnSelect` and `selectOnClose` used to be combined, because they
both were listening to events triggered by the other one. The problem
was that `selectOnClose` was triggering `select` events for data objects
which had already been selected. This problem was solved by checking if
the data object was already selected before trying to select it again.

This closes select2#3751.
This closes select2#3169.
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