capybara-select2
capybara-select2 copied to clipboard
Fix select2 version 4 support to handle grouped options
When options are grouped, their group has the class select2-results__option, and the attribute role=group. Absent this fix, that means selections against grouped fields result in:
Capybara::Ambiguous:
Ambiguous match, found 2 elements matching visible css ".select2-dropdown li.select2-results__option" with text "TEXT" within #<Capybara::Node::Element tag="body" path="/html/body">
The fix is to exclude the group options on lookup.