Created
January 1, 2013 18:21
-
-
Save skamithi/4429127 to your computer and use it in GitHub Desktop.
Cucumber steps to check if search field is cleared but is still focused after the clear.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When /^I click the clear search button$/ do | |
find('#search_icon').click | |
end | |
Then /^the search field should be focused$/ do | |
page.execute_script <<-JS | |
if (jQuery('#search_form input[type=search]').is(':focus')) { | |
jQuery('#search_form').append("<div id='search_form_is_focused' />"); | |
} | |
JS | |
page.should have_selector('#search_form_is_focused') | |
end | |
Then /^the search field should be empty$/ do | |
page.should have_selector('#search_form input[type=search]', :text => '') | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment