Merge commit 'quirkey/master'

This commit is contained in:
Bryan Helmkamp 2008-07-25 18:46:57 -04:00
commit 0fdd3375c7

View File

@ -42,6 +42,10 @@ module Webrat
label.matches_text?(label_text) label.matches_text?(label_text)
end end
def matches_alt?(alt)
@element["alt"] =~ /^\W*#{Regexp.escape(alt.to_s)}/i
end
def to_param def to_param
value = @value.to_s.gsub('&', '%26') value = @value.to_s.gsub('&', '%26')
param_parser.parse_query_parameters("#{name}=#{value}") param_parser.parse_query_parameters("#{name}=#{value}")
@ -124,7 +128,7 @@ module Webrat
end end
def matches_value?(value) def matches_value?(value)
@element["value"] =~ /^\W*#{Regexp.escape(value.to_s)}/i || matches_text?(value) @element["value"] =~ /^\W*#{Regexp.escape(value.to_s)}/i || matches_text?(value) || matches_alt?(value)
end end
def to_param def to_param