Skip to content
Browse files

Added failing tests for click_button to find and submit image input b…

…uttons using the text of the alt attribute
  • Loading branch information...
1 parent 99a3bd8 commit 125478fe2666e81d4c9ba3721dacf231987deb6c @bjeanes bjeanes committed Feb 25, 2010
Showing with 13 additions and 1 deletion.
  1. +12 −0 spec/dsl/click_button_spec.rb
  2. +1 −1 spec/views/form.erb
12 spec/dsl/click_button_spec.rb
@@ -113,6 +113,18 @@
@session.body.should include('You landed')
+ context "with alt given on an image button" do
+ it "should submit the associated form" do
+ @session.click_button('oh hai thar')
+ extract_results(@session)['first_name'].should == 'John'
+ end
+ it "should work with partial matches" do
+ @session.click_button('hai')
+ extract_results(@session)['first_name'].should == 'John'
+ end
+ end
context "with value given on an image button" do
it "should submit the associated form" do
2 spec/views/form.erb
@@ -151,7 +151,7 @@
<input type="button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
<input type="submit" name="form[awesome]" id="awe123" value="awesome"/>
<input type="submit" name="form[crappy]" id="crap321" value="crappy"/>
- <input type="image" name="form[okay]" id="okay556" value="okay"/>
+ <input type="image" name="form[okay]" id="okay556" value="okay" alt="oh hai thar"/>
<button type="submit" id="click_me_123" value="click_me">Click me!</button>

0 comments on commit 125478f

Please sign in to comment.
Something went wrong with that request. Please try again.