Behat/MinkSelenium2Driver — pull request #157 by stof (2014-05-17 18:42:37+00:00)
Title: Added the support of multiple select boxes in setValue

Note that there is several ways this could be implemented:

1. deselecting everything in JS (without change event) and then selecting the options we need (with a change event for each of them triggered by Selenium)
2. doing a diff of the currently selected options and the expected ones and then selecting/unselecting the needed ones (with a change event triggered by Selenium for each modifications)
3. determining all the actions to do in the diff (same than option 2), doing all of them except one in JS (without change event) and doing the last one through Selenium (to trigger a single change event)

All options have their pros and cons regarding the change event (and the most realistic one depends of the way the browser implements its UI for multiple select boxes, which is different for desktop browsers and mobile browsers for instance).
For the sake of simplicity (reusing the code we already have), I went for option 1, even if it misses a change event when deselecting everything and triggers multiple change events when selecting the current values.