KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a simple link_to_function in my view template <%= link_to_function "add new category", "$('#category_name').focus()" %> and I want to test this with capybara using request specs. Basically the spec should look something like this it "focuses category form when I click 'add new category'" do visit new_article_path click_link "add new category" # unfortunately there's nothing like 'has_focus?' find_field("category_name").should have_focus end the problem is, I wasn't able to find anything, that would check if the element has focus. The only thing I did find was this page.evaluate_script('document.focus')[:id] which however isn't supported by the capybara-wekbit driver, which I'm using to avoid opening browser for each test run.
Tags (comma-separated)
Save Edits
Cancel