Skip to content

Instantly share code, notes, and snippets.

@simonrentzke
Created June 2, 2010 12:38
Show Gist options
  • Save simonrentzke/422316 to your computer and use it in GitHub Desktop.
Save simonrentzke/422316 to your computer and use it in GitHub Desktop.
# Then /^"([^\"]*)" should be in the autocomplete menu$/ do |name|
# xpath_to_auto_complete_selection = "//ul[contains(@class, 'ui-autocomplete')]"
#
# # wait until auto complete menu appears
# page.should have_xpath(xpath_to_auto_complete_selection)
# page.evaluate_script('$("#show_title").attr("value", "my p")')
# page.evaluate_script('e = jQuery.Event("keydown")')
# page.evaluate_script('e.which = 67')
# page.evaluate_script('$("#show_title").trigger("focus").trigger(e)')
#
# debugger
# # check that the correct value is selected
# find(xpath_to_auto_complete_selection).text.should == name
# end
#
# Then "trigger autocomplete menu" do
# page.evaluate_script('e = jQuery.Event("keydown");e.which = 67;$("#show_title").trigger("focus").trigger(e);');
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment