bjeanes-capybara 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ require 'timeout'
2
2
  require 'nokogiri'
3
3
 
4
4
  module Capybara
5
- VERSION = '0.3.1'
5
+ VERSION = '0.3.2'
6
6
 
7
7
  class CapybaraError < StandardError; end
8
8
  class DriverNotFoundError < CapybaraError; end
@@ -80,6 +80,7 @@ module Capybara
80
80
  xpath = append("//input[@type='submit' or @type='image' or @type='button'][@id=#{s(locator)} or contains(@value,#{s(locator)})]")
81
81
  xpath = xpath.append("//button[@id=#{s(locator)} or contains(@value,#{s(locator)}) or contains(.,#{s(locator)})]")
82
82
  xpath = xpath.prepend("//input[@type='submit' or @type='image' or @type='button'][@value=#{s(locator)}]")
83
+ xpath = xpath.prepend("//input[@type='image'][@alt=#{s(locator)} or contains(@alt,#{s(locator)})]")
83
84
  xpath = xpath.prepend("//button[@value=#{s(locator)} or text()=#{s(locator)}]")
84
85
  end
85
86
 
@@ -113,6 +113,18 @@ shared_examples_for "click_button" do
113
113
  @session.body.should include('You landed')
114
114
  end
115
115
  end
116
+
117
+ context "with alt given on an image button" do
118
+ it "should submit the associated form" do
119
+ @session.click_button('oh hai thar')
120
+ extract_results(@session)['first_name'].should == 'John'
121
+ end
122
+
123
+ it "should work with partial matches" do
124
+ @session.click_button('hai')
125
+ extract_results(@session)['first_name'].should == 'John'
126
+ end
127
+ end
116
128
 
117
129
  context "with value given on an image button" do
118
130
  it "should submit the associated form" do
@@ -151,7 +151,7 @@
151
151
  <input type="button" name="form[fresh]" id="fresh_btn" value="i am fresh"/>
152
152
  <input type="submit" name="form[awesome]" id="awe123" value="awesome"/>
153
153
  <input type="submit" name="form[crappy]" id="crap321" value="crappy"/>
154
- <input type="image" name="form[okay]" id="okay556" value="okay"/>
154
+ <input type="image" name="form[okay]" id="okay556" value="okay" alt="oh hai thar"/>
155
155
  <button type="submit" id="click_me_123" value="click_me">Click me!</button>
156
156
  </p>
157
157
  </form>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bjeanes-capybara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas