Added recognition of input tags with type button, which are generated by the Rails submit_to_remote helper
This commit is contained in:
parent
9825aee47e
commit
b4d85cb50b
@ -45,6 +45,7 @@ module Webrat
|
|||||||
when "file" then FileField
|
when "file" then FileField
|
||||||
when "reset" then ResetField
|
when "reset" then ResetField
|
||||||
when "submit" then ButtonField
|
when "submit" then ButtonField
|
||||||
|
when "button" then ButtonField
|
||||||
when "image" then ButtonField
|
when "image" then ButtonField
|
||||||
else TextField
|
else TextField
|
||||||
end
|
end
|
||||||
@ -168,7 +169,7 @@ module Webrat
|
|||||||
class ButtonField < Field #:nodoc:
|
class ButtonField < Field #:nodoc:
|
||||||
|
|
||||||
def self.xpath_search
|
def self.xpath_search
|
||||||
[".//button", ".//input[@type = 'submit']", ".//input[@type = 'image']"]
|
[".//button", ".//input[@type = 'submit']", ".//input[@type = 'button']", ".//input[@type = 'image']"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_param
|
def to_param
|
||||||
|
@ -439,6 +439,18 @@ describe "click_button" do
|
|||||||
click_button
|
click_button
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should recognize input tags with the type button" do
|
||||||
|
with_html <<-HTML
|
||||||
|
<html>
|
||||||
|
<form action="/">
|
||||||
|
<input type="button" />
|
||||||
|
</form>
|
||||||
|
</html>
|
||||||
|
HTML
|
||||||
|
webrat_session.should_receive(:get)
|
||||||
|
click_button
|
||||||
|
end
|
||||||
|
|
||||||
it "should recognize image button tags" do
|
it "should recognize image button tags" do
|
||||||
with_html <<-HTML
|
with_html <<-HTML
|
||||||
<html>
|
<html>
|
||||||
|
Loading…
Reference in New Issue
Block a user