Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

form: wait for the result when using autocomplete fields

  • Loading branch information...
commit 0250c8537fa994dce68810a5f70561923c01564f 1 parent d51f684
Yves Senn authored

Showing 1 changed file with 4 additions and 1 deletion. Show diff stats Hide diff stats

  1. +4 1 lib/corner_stones/form.rb
5 lib/corner_stones/form.rb
@@ -43,7 +43,10 @@ def autocomplete(value, options)
43 43 fill_in(options[:in], :with => value)
44 44 page.execute_script %Q{ $('##{autocomplete_id}').trigger("focus") }
45 45 page.execute_script %Q{ $('##{autocomplete_id}').trigger("keydown") }
46   - sleep 1
  46 + wait_until do
  47 + result = page.evaluate_script %Q{ $('.ui-menu-item a:contains("#{value}")').size() }
  48 + result > 0
  49 + end
47 50 page.execute_script %Q{ $('.ui-menu-item a:contains("#{value}")').trigger("mouseenter").trigger("click"); }
48 51 end
49 52

0 comments on commit 0250c85

Please sign in to comment.
Something went wrong with that request. Please try again.