mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Merge pull request #1492 from jnicklas/javascript_void
javascript:void(0) href fix
This commit is contained in:
commit
74d9d53c3d
3 changed files with 4 additions and 1 deletions
|
@ -27,7 +27,7 @@ class Capybara::RackTest::Browser
|
|||
end
|
||||
|
||||
def follow(method, path, attributes = {})
|
||||
return if path.gsub(/^#{request_path}/, '').start_with?('#')
|
||||
return if path.gsub(/^#{request_path}/, '').start_with?('#') || path.downcase.start_with?('javascript:')
|
||||
process_and_follow_redirects(method, path, attributes, {'HTTP_REFERER' => current_url})
|
||||
end
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ Capybara::SpecHelper.spec '#click_link' do
|
|||
expect(@session.find_field("test_field").value).to eq('blah')
|
||||
@session.click_link('Blank Anchor')
|
||||
expect(@session.find_field("test_field").value).to eq('blah')
|
||||
@session.click_link('Blank JS Anchor')
|
||||
expect(@session.find_field("test_field").value).to eq('blah')
|
||||
end
|
||||
|
||||
it "should do nothing on URL+anchor links for the same page" do
|
||||
|
|
|
@ -45,6 +45,7 @@ banana</textarea>
|
|||
<a>No Href</a>
|
||||
<a href="">Blank Href</a>
|
||||
<a href="#">Blank Anchor</a>
|
||||
<a href="javascript:void(0)">Blank JS Anchor</a>
|
||||
<a href="#anchor">Normal Anchor</a>
|
||||
<a href="/with_simple_html#anchor">Anchor on different page</a>
|
||||
<a href="/with_html#anchor">Anchor on same page</a>
|
||||
|
|
Loading…
Reference in a new issue