Added method for matching alt attributes in fields (primarly for clicks_button)

This commit is contained in:
Aaron Quint 2008-05-27 17:17:49 -04:00
parent e6aff6d37c
commit 9a4e43ab0c

View File

@ -42,6 +42,10 @@ module Webrat
label.matches_text?(label_text)
end
def matches_alt?(alt)
@element["alt"] =~ /^\W*#{Regexp.escape(alt.to_s)}/i
end
def to_param
param_parser.parse_query_parameters("#{name}=#{@value}")
end
@ -123,7 +127,7 @@ module Webrat
end
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
def to_param