Support  's as spaces in matching link text (Patch from Luke Melia)
This commit is contained in:
parent
2e20267c90
commit
8405c6cfb0
@ -20,8 +20,9 @@ module Webrat
|
||||
end
|
||||
|
||||
def matches_text?(link_text)
|
||||
html = text.gsub(' ',' ')
|
||||
matcher = /#{Regexp.escape(link_text.to_s)}/i
|
||||
text =~ matcher || title =~ matcher
|
||||
html =~ matcher || title =~ matcher
|
||||
end
|
||||
|
||||
def text
|
||||
|
@ -29,6 +29,7 @@ describe "clicks_link" do
|
||||
@session.clicks_delete_link "Link text"
|
||||
end
|
||||
|
||||
|
||||
it "should click post links" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page">Link text</a>
|
||||
@ -181,6 +182,15 @@ describe "clicks_link" do
|
||||
@session.clicks_link "Link"
|
||||
end
|
||||
|
||||
it "should treat non-breaking spaces as spaces" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page1">This is a link</a>
|
||||
EOS
|
||||
|
||||
@session.should_receive(:get).with("/page1", {})
|
||||
@session.clicks_link "This is a link"
|
||||
end
|
||||
|
||||
it "should click link within a selector" do
|
||||
@session.response_body = <<-EOS
|
||||
<a href="/page1">Link</a>
|
||||
|
Loading…
Reference in New Issue
Block a user