Skip to content

Commit

Permalink
Merge pull request #16 from msx2/selector-refatoring
Browse files Browse the repository at this point in the history
Selector refatoring
  • Loading branch information
msx2 committed Sep 27, 2015
2 parents 44ae1e2 + e4d1a29 commit 5afe8c0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/selectivity/rails/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Selectivity
module Rails
VERSION = '0.1.5'
VERSION = '0.1.6'
end
end
8 changes: 7 additions & 1 deletion lib/selectivity/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ def _selectivity_select!(input, item)
input.click

within 'div.selectivity-dropdown' do
if find('div.selectivity-result-item', text: item).visible?
element = if page.driver.class.name =~ /poltergeist/i
find('div.selectivity-result-item', text: item)
else
find(:xpath, "//div[@class='selectivity-result-item'][contains(text(), '#{item}')]")
end

if element.visible?
page.evaluate_script("$('div.selectivity-result-item:contains(#{item})').trigger('click')")
end
end
Expand Down

0 comments on commit 5afe8c0

Please sign in to comment.