Added method for matching alt attributes in fields (primarly for clicks_button)
This commit is contained in:
parent
e6aff6d37c
commit
9a4e43ab0c
|
@ -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
|
||||||
param_parser.parse_query_parameters("#{name}=#{@value}")
|
param_parser.parse_query_parameters("#{name}=#{@value}")
|
||||||
end
|
end
|
||||||
|
@ -123,7 +127,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
|
||||||
|
|
Loading…
Reference in New Issue