Now you can do clicks_button 'foo_123' (passing button ID, not value)
This commit is contained in:
parent
20561b0c41
commit
9e673539a5
@ -106,6 +106,10 @@ module Webrat
|
|||||||
@element["value"] =~ /^\W*#{Regexp.escape(value.to_s)}/i
|
@element["value"] =~ /^\W*#{Regexp.escape(value.to_s)}/i
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def matches_id?(id)
|
||||||
|
@element["id"] =~ /^\W*#{Regexp.escape(id.to_s)}/i
|
||||||
|
end
|
||||||
|
|
||||||
def matches_caption?(value)
|
def matches_caption?(value)
|
||||||
@element.innerHTML =~ /^\W*#{Regexp.escape(value.to_s)}/i
|
@element.innerHTML =~ /^\W*#{Regexp.escape(value.to_s)}/i
|
||||||
end
|
end
|
||||||
|
@ -33,6 +33,10 @@ module Webrat
|
|||||||
|
|
||||||
possible_buttons = fields_by_type([ButtonField])
|
possible_buttons = fields_by_type([ButtonField])
|
||||||
|
|
||||||
|
possible_buttons.each do |possible_button|
|
||||||
|
return possible_button if possible_button.matches_id?(value)
|
||||||
|
end
|
||||||
|
|
||||||
possible_buttons.each do |possible_button|
|
possible_buttons.each do |possible_button|
|
||||||
return possible_button if possible_button.matches_value?(value)
|
return possible_button if possible_button.matches_value?(value)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user