Merge remote branch 'ursm/input-without-type'

Conflicts:
	lib/capybara/driver/rack_test_driver.rb
	lib/capybara/driver/selenium_driver.rb
This commit is contained in:
Jonas Nicklas 2010-06-19 17:46:54 +02:00
commit a94f9949d5
4 changed files with 9 additions and 3 deletions

View File

@ -112,7 +112,7 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
def params(button)
params = {}
node.xpath(".//input[@type!='radio' and @type!='checkbox' and @type!='submit' and @type!='image']").map do |input|
node.xpath(".//input[not(@type) or (@type!='radio' and @type!='checkbox' and @type!='submit' and @type!='image')]").map do |input|
merge_param!(params, input['name'].to_s, input['value'].to_s)
end
node.xpath(".//textarea").map do |textarea|

View File

@ -58,6 +58,12 @@ shared_examples_for "fill_in" do
extract_results(@session)['schmooo'].should == 'Schmooo is the game'
end
it "should fill in a field without a type" do
@session.fill_in('Phone', :with => '+1 555 7022')
@session.click_button('awesome')
extract_results(@session)['phone'].should == '+1 555 7022'
end
it "should fill in a password field by name" do
@session.fill_in('form[password]', :with => 'supasikrit')
@session.click_button('awesome')

View File

@ -46,7 +46,7 @@
<p>
<label for="form_phone">Phone</label>
<input type="text" name="form[phone]" value="+1 555 7021" id="form_phone"/>
<input name="form[phone]" value="+1 555 7021" id="form_phone"/>
</p>
<p>

View File

@ -111,7 +111,7 @@ module Capybara
def text_field(locator, options={})
options = options.merge(:value => options[:with]) if options.has_key?(:with)
add_field(locator, "//input[@type!='radio' and @type!='checkbox' and @type!='hidden']", options)
add_field(locator, "//input[not(@type) or (@type!='radio' and @type!='checkbox' and @type!='hidden')]", options)
end
def text_area(locator, options={})