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

Cannot use select2 within modal #1

Closed
atd opened this issue Sep 11, 2018 · 4 comments
Closed

Cannot use select2 within modal #1

atd opened this issue Sep 11, 2018 · 4 comments

Comments

@atd
Copy link

atd commented Sep 11, 2018

This code fails:

within('#someModal') do
  select2 'some_tag', from 'Tags', tag: true
end

is failing with:

Unable to find visible css ".select2-container-active .select2-result,.select2-drop-active .select2-result,.select2-results .select2-results
__option" with text "some_tag" within #<Capybara::Node::Element tag="div" path="/html/body/div[@id='modalBlock']/div[@id='someModal']"

This is because the selected option is added to a container outside the modal

Maybe https://github.com/Hirurg103/capybara_select2/blob/master/lib/capybara_select2/helpers.rb#L42 should search from the body?

Thank you for reviving this gem!

@Hirurg103
Copy link
Owner

Hi @atd

I updated the gem but forgot to update the README

In the latest version (0.2.0) you need to specify select 2 version which you are using. See Configuration

Try to upgrade the gem and configure version of select2 which you are you using

@Hirurg103
Copy link
Owner

@atd if it still doesn't work could you please specify which modal you are using and attach screenshots or markdown if possible

@Hirurg103
Copy link
Owner

Maybe https://github.com/Hirurg103/capybara_select2/blob/master/lib/capybara_select2/helpers.rb#L42 should search from the body?

Yes, you are right. I see the issue now. I will fix it shortly

@Hirurg103
Copy link
Owner

@atd this but should be fixed in version 0.2.1

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

No branches or pull requests

2 participants