Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gem/lib/capybara-select2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def select2(value, options = {})
[value].flatten.each do |value|
if find(:xpath, "//body").has_selector?("#{drop_container} li.select2-results__option")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the role attribute should be added to this line as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.

Should it? Did you run into a situation where this was an issue? I am asking because the comment on line 42 says 'select2 version 4.0' which might indicate that the API is not always the same.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works good for me.

# select2 version 4.0
find(:xpath, "//body").find("#{drop_container} li.select2-results__option", text: value).click
find(:xpath, "//body").find("#{drop_container} li.select2-results__option[role='treeitem']", text: value).click
else
find(:xpath, "//body").find("#{drop_container} li.select2-result-selectable", text: value).click
end
Expand Down