Skip to content

Commit

Permalink
Merge commit 'lenalena/master' into lh_139
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Jan 28, 2009
2 parents d2d8de7 + b4d85cb commit 7f9df54
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/webrat/core/elements/field.rb
Expand Up @@ -45,6 +45,7 @@ def self.field_class(element)
when "file" then FileField
when "reset" then ResetField
when "submit" then ButtonField
when "button" then ButtonField
when "image" then ButtonField
else TextField
end
Expand Down Expand Up @@ -177,7 +178,7 @@ def replace_param_value(params, oval, nval)
class ButtonField < Field #:nodoc:

def self.xpath_search
[".//button", ".//input[@type = 'submit']", ".//input[@type = 'image']"]
[".//button", ".//input[@type = 'submit']", ".//input[@type = 'button']", ".//input[@type = 'image']"]
end

def to_param
Expand Down
14 changes: 13 additions & 1 deletion spec/public/click_button_spec.rb
Expand Up @@ -425,7 +425,7 @@
webrat_session.should_receive(:get).with("/login", "user" => {"email" => ""})
click_button
end

it "should recognize button tags" do
with_html <<-HTML
<html>
Expand All @@ -439,6 +439,18 @@
click_button
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
with_html <<-HTML
<html>
Expand Down

0 comments on commit 7f9df54

Please sign in to comment.